@mercuryo-ai/agentbrowse 0.2.60 → 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 +33 -1
- package/README.md +132 -14
- package/dist/browser-session-state.d.ts +40 -10
- package/dist/browser-session-state.d.ts.map +1 -1
- package/dist/browser-session-state.js +63 -5
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +548 -535
- package/dist/commands/attach.d.ts +1 -3
- package/dist/commands/attach.d.ts.map +1 -1
- package/dist/commands/attach.js +5 -12
- package/dist/commands/browser-connection-failure.d.ts +9 -0
- package/dist/commands/browser-connection-failure.d.ts.map +1 -0
- package/dist/commands/browser-connection-failure.js +15 -0
- package/dist/commands/browser-status.d.ts +0 -2
- package/dist/commands/browser-status.d.ts.map +1 -1
- package/dist/commands/browser-status.js +27 -37
- package/dist/commands/close.d.ts.map +1 -1
- package/dist/commands/close.js +5 -0
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +147 -144
- package/dist/commands/interaction-kernel.d.ts +1 -1
- package/dist/commands/interaction-kernel.d.ts.map +1 -1
- package/dist/commands/interaction-kernel.js +1 -1
- package/dist/commands/launch.d.ts +0 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +11 -12
- package/dist/commands/navigate.d.ts.map +1 -1
- package/dist/commands/navigate.js +79 -73
- package/dist/commands/observe-accessibility.d.ts.map +1 -1
- package/dist/commands/observe-accessibility.js +36 -2
- package/dist/commands/observe-inventory.d.ts +50 -7
- package/dist/commands/observe-inventory.d.ts.map +1 -1
- package/dist/commands/observe-inventory.js +822 -99
- package/dist/commands/observe-persistence.d.ts.map +1 -1
- package/dist/commands/observe-persistence.js +49 -6
- package/dist/commands/observe-projection.d.ts +6 -2
- package/dist/commands/observe-projection.d.ts.map +1 -1
- package/dist/commands/observe-projection.js +251 -27
- package/dist/commands/observe-semantics.d.ts +1 -0
- package/dist/commands/observe-semantics.d.ts.map +1 -1
- package/dist/commands/observe-semantics.js +541 -135
- package/dist/commands/observe-signals.d.ts +4 -4
- package/dist/commands/observe-signals.d.ts.map +1 -1
- package/dist/commands/observe-signals.js +2 -2
- package/dist/commands/observe-surfaces.d.ts +2 -1
- package/dist/commands/observe-surfaces.d.ts.map +1 -1
- package/dist/commands/observe-surfaces.js +143 -45
- package/dist/commands/observe.d.ts +5 -1
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +266 -274
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/screenshot.js +50 -64
- package/dist/commands/semantic-observe.d.ts.map +1 -1
- package/dist/commands/semantic-observe.js +43 -0
- package/dist/library.d.ts +3 -1
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +3 -1
- package/dist/match-resolve-fill.d.ts +196 -0
- package/dist/match-resolve-fill.d.ts.map +1 -0
- package/dist/match-resolve-fill.js +700 -0
- package/dist/match-resolve-fill.test-support.d.ts +34 -0
- package/dist/match-resolve-fill.test-support.d.ts.map +1 -0
- package/dist/match-resolve-fill.test-support.js +81 -0
- package/dist/protected-fill.d.ts.map +1 -1
- package/dist/protected-fill.js +46 -7
- package/dist/runtime-protected-state.d.ts.map +1 -1
- package/dist/runtime-protected-state.js +12 -0
- package/dist/runtime-state.d.ts +6 -0
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +6 -0
- package/dist/secrets/form-matcher.d.ts.map +1 -1
- package/dist/secrets/form-matcher.js +76 -27
- package/dist/secrets/protected-exact-value-redaction.d.ts.map +1 -1
- package/dist/secrets/protected-exact-value-redaction.js +6 -0
- package/dist/secrets/protected-fill.js +3 -3
- package/dist/session.d.ts +3 -3
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +2 -2
- package/dist/solver/browser-launcher.d.ts.map +1 -1
- package/dist/solver/browser-launcher.js +2 -1
- package/dist/sticky-owner-host-entry.d.ts +2 -0
- package/dist/sticky-owner-host-entry.d.ts.map +1 -0
- package/dist/sticky-owner-host-entry.js +97 -0
- package/dist/sticky-owner.d.ts +15 -0
- package/dist/sticky-owner.d.ts.map +1 -0
- package/dist/sticky-owner.js +431 -0
- package/dist/testing.d.ts +1 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -0
- package/docs/README.md +28 -11
- package/docs/api-reference.md +311 -19
- package/docs/assistive-runtime.md +41 -16
- package/docs/configuration.md +36 -4
- package/docs/getting-started.md +73 -5
- package/docs/integration-checklist.md +32 -3
- package/docs/match-resolve-fill.md +699 -0
- package/docs/protected-fill.md +373 -91
- package/docs/testing.md +147 -15
- package/docs/troubleshooting.md +47 -6
- package/examples/README.md +7 -0
- package/examples/match-resolve-fill.ts +107 -0
- package/package.json +4 -2
- package/dist/protected-fill-browser.d.ts +0 -22
- package/dist/protected-fill-browser.d.ts.map +0 -1
- package/dist/protected-fill-browser.js +0 -52
|
@@ -6,8 +6,10 @@ import { getProtectedExposure } from '../runtime-protected-state.js';
|
|
|
6
6
|
import { saveSession } from '../session.js';
|
|
7
7
|
import { outputFailure, outputJSON, outputContractFailure, info } from '../output.js';
|
|
8
8
|
import { captureDiagnosticSnapshotBestEffort, finishDiagnosticStepBestEffort, recordCommandLifecycleEventBestEffort, startDiagnosticStep, } from '../diagnostics.js';
|
|
9
|
-
import {
|
|
9
|
+
import { resolveCurrentPageContext, syncSessionPage } from '../playwright-runtime.js';
|
|
10
10
|
import { buildProtectedScreenshotBlockedResult, } from '../secrets/protected-artifact-guard.js';
|
|
11
|
+
import { describeBrowserConnectionFailure } from './browser-connection-failure.js';
|
|
12
|
+
import { withStickyOwnerBrowser } from '../sticky-owner.js';
|
|
11
13
|
/** Stable top-level error codes returned by `screenshot(...)`. */
|
|
12
14
|
export const SCREENSHOT_ERROR_CODES = [
|
|
13
15
|
'browser_connection_failed',
|
|
@@ -172,81 +174,65 @@ export async function screenshotBrowser(session, filePath) {
|
|
|
172
174
|
protectedStep: Boolean(initialProtectedExposure),
|
|
173
175
|
},
|
|
174
176
|
});
|
|
175
|
-
let browser = null;
|
|
176
|
-
let failureMessage = null;
|
|
177
|
-
let page = null;
|
|
178
177
|
try {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
178
|
+
return await withStickyOwnerBrowser(session, async (browser) => {
|
|
179
|
+
try {
|
|
180
|
+
const resolvedPage = await resolveCurrentPageContext(browser, session);
|
|
181
|
+
pageRef = resolvedPage.pageRef;
|
|
182
|
+
const page = resolvedPage.page;
|
|
183
|
+
const recoveredProtectedExposure = getProtectedExposure(session, pageRef) ?? (!page ? initialProtectedExposure : null);
|
|
184
|
+
if (recoveredProtectedExposure) {
|
|
185
|
+
if (page && pageRef !== initialPageRef) {
|
|
186
|
+
setCurrentPage(session, pageRef);
|
|
187
|
+
}
|
|
188
|
+
return buildScreenshotFailureResult(session, {
|
|
189
|
+
step: screenshotStepHandle,
|
|
190
|
+
...buildProtectedScreenshotBlockedResult(recoveredProtectedExposure),
|
|
191
|
+
runId: session.activeRunId,
|
|
192
|
+
stepId: screenshotStep?.stepId,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (!page) {
|
|
196
|
+
throw new Error('no_open_pages');
|
|
197
|
+
}
|
|
198
|
+
await page.screenshot({ path: outputPath });
|
|
199
|
+
const { url, title } = await syncSessionPage(session, pageRef, page);
|
|
200
|
+
setCurrentPage(session, pageRef);
|
|
201
|
+
return buildScreenshotSuccessResult({
|
|
202
|
+
session,
|
|
203
|
+
step: screenshotStepHandle,
|
|
204
|
+
runId: session.activeRunId,
|
|
205
|
+
stepId: screenshotStep?.stepId,
|
|
206
|
+
pageRef,
|
|
207
|
+
path: outputPath,
|
|
208
|
+
url,
|
|
209
|
+
title,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
throw new Error(`screenshot_failed:${error instanceof Error ? error.message : String(error)}`);
|
|
214
|
+
}
|
|
190
215
|
});
|
|
191
216
|
}
|
|
192
|
-
try {
|
|
193
|
-
const resolvedPage = await resolveCurrentPageContext(browser, session);
|
|
194
|
-
pageRef = resolvedPage.pageRef;
|
|
195
|
-
page = resolvedPage.page;
|
|
196
|
-
}
|
|
197
217
|
catch (err) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
setCurrentPage(session, pageRef);
|
|
204
|
-
}
|
|
205
|
-
if (browser) {
|
|
206
|
-
await disconnectPlaywright(browser);
|
|
207
|
-
browser = null;
|
|
208
|
-
}
|
|
209
|
-
return buildScreenshotFailureResult(session, {
|
|
210
|
-
step: screenshotStepHandle,
|
|
211
|
-
...buildProtectedScreenshotBlockedResult(recoveredProtectedExposure),
|
|
212
|
-
runId: session.activeRunId,
|
|
213
|
-
stepId: screenshotStep?.stepId,
|
|
218
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
219
|
+
const isCommandFailure = reason.startsWith('screenshot_failed:');
|
|
220
|
+
const browserConnectionFailure = describeBrowserConnectionFailure(err, {
|
|
221
|
+
defaultMessage: 'Screenshot capture could not start because AgentBrowse failed to connect to the browser.',
|
|
222
|
+
unrecoverableSessionMessage: 'Screenshot capture could not start because the previous browser session is no longer reachable.',
|
|
214
223
|
});
|
|
215
|
-
}
|
|
216
|
-
try {
|
|
217
|
-
if (!page) {
|
|
218
|
-
throw new Error(failureMessage?.replace(/^Screenshot failed:\s*/, '') ?? 'no_open_pages');
|
|
219
|
-
}
|
|
220
|
-
await page.screenshot({ path: outputPath });
|
|
221
|
-
const { url, title } = await syncSessionPage(session, pageRef, page);
|
|
222
|
-
setCurrentPage(session, pageRef);
|
|
223
|
-
return buildScreenshotSuccessResult({
|
|
224
|
-
session,
|
|
225
|
-
step: screenshotStepHandle,
|
|
226
|
-
runId: session.activeRunId,
|
|
227
|
-
stepId: screenshotStep?.stepId,
|
|
228
|
-
pageRef,
|
|
229
|
-
path: outputPath,
|
|
230
|
-
url,
|
|
231
|
-
title,
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
catch (err) {
|
|
235
224
|
return buildScreenshotContractFailureResult(session, {
|
|
236
225
|
step: screenshotStepHandle,
|
|
237
|
-
error: 'screenshot_failed',
|
|
226
|
+
error: isCommandFailure ? 'screenshot_failed' : 'browser_connection_failed',
|
|
238
227
|
outcomeType: 'blocked',
|
|
239
|
-
message: 'Screenshot capture failed.',
|
|
240
|
-
reason:
|
|
228
|
+
message: isCommandFailure ? 'Screenshot capture failed.' : browserConnectionFailure.message,
|
|
229
|
+
reason: isCommandFailure
|
|
230
|
+
? reason.replace(/^screenshot_failed:/, '')
|
|
231
|
+
: browserConnectionFailure.reason,
|
|
241
232
|
runId: session.activeRunId,
|
|
242
233
|
stepId: screenshotStep?.stepId,
|
|
243
234
|
});
|
|
244
235
|
}
|
|
245
|
-
finally {
|
|
246
|
-
if (browser) {
|
|
247
|
-
await disconnectPlaywright(browser);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
236
|
}
|
|
251
237
|
/** CLI wrapper for `screenshotBrowser(...)` that persists session changes and writes JSON output. */
|
|
252
238
|
export async function screenshot(session, filePath) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-observe.d.ts","sourceRoot":"","sources":["../../src/commands/semantic-observe.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAY7B,KAAK,sBAAsB,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM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AAsB,EAC5E,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EACzB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAAO,GAC9C,OAAO,CAAC,CAAC,EAAE,CAAC,CAkHd"}
|
|
@@ -239,6 +239,10 @@ function cachedStructureValue(structure) {
|
|
|
239
239
|
return {
|
|
240
240
|
...(structure.family ? { family: structure.family } : {}),
|
|
241
241
|
...(structure.variant ? { variant: structure.variant } : {}),
|
|
242
|
+
...(structure.dateIso ? { dateIso: structure.dateIso } : {}),
|
|
243
|
+
...(typeof structure.dateYear === 'number' ? { dateYear: structure.dateYear } : {}),
|
|
244
|
+
...(typeof structure.dateMonth === 'number' ? { dateMonth: structure.dateMonth } : {}),
|
|
245
|
+
...(typeof structure.dateDay === 'number' ? { dateDay: structure.dateDay } : {}),
|
|
242
246
|
...(structure.row ? { row: structure.row } : {}),
|
|
243
247
|
...(structure.column ? { column: structure.column } : {}),
|
|
244
248
|
...(structure.zone ? { zone: structure.zone } : {}),
|
|
@@ -263,6 +267,34 @@ function appendGoalIdentityAlias(values, value) {
|
|
|
263
267
|
}
|
|
264
268
|
values.push(normalized);
|
|
265
269
|
}
|
|
270
|
+
function structuredDateIdentityOf(structure) {
|
|
271
|
+
if (!structure || structure.family !== 'structured-grid' || structure.variant !== 'date-cell') {
|
|
272
|
+
return undefined;
|
|
273
|
+
}
|
|
274
|
+
const iso = normalizeGoalIdentityValue(structure.dateIso, 32);
|
|
275
|
+
const year = typeof structure.dateYear === 'number' ? structure.dateYear : undefined;
|
|
276
|
+
const month = typeof structure.dateMonth === 'number' ? structure.dateMonth : undefined;
|
|
277
|
+
const day = typeof structure.dateDay === 'number' ? structure.dateDay : undefined;
|
|
278
|
+
if (!iso && year === undefined && month === undefined && day === undefined) {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
return { iso, year, month, day };
|
|
282
|
+
}
|
|
283
|
+
function structuredDateGoalIdentityValues(target) {
|
|
284
|
+
const identity = structuredDateIdentityOf(target.structure);
|
|
285
|
+
if (!identity) {
|
|
286
|
+
return [];
|
|
287
|
+
}
|
|
288
|
+
const values = [];
|
|
289
|
+
appendGoalIdentityAlias(values, identity.iso);
|
|
290
|
+
if (typeof identity.year === 'number' &&
|
|
291
|
+
typeof identity.month === 'number' &&
|
|
292
|
+
typeof identity.day === 'number') {
|
|
293
|
+
appendGoalIdentityAlias(values, `${identity.year} ${identity.month} ${identity.day}`);
|
|
294
|
+
appendGoalIdentityAlias(values, `${identity.day} ${identity.month} ${identity.year}`);
|
|
295
|
+
}
|
|
296
|
+
return values;
|
|
297
|
+
}
|
|
266
298
|
function goalIdentityValuesOf(target) {
|
|
267
299
|
const values = [];
|
|
268
300
|
appendGoalIdentityAlias(values, target.goalLabel);
|
|
@@ -272,6 +304,9 @@ function goalIdentityValuesOf(target) {
|
|
|
272
304
|
if (values.length > 0) {
|
|
273
305
|
return values;
|
|
274
306
|
}
|
|
307
|
+
for (const value of structuredDateGoalIdentityValues(target)) {
|
|
308
|
+
appendGoalIdentityAlias(values, value);
|
|
309
|
+
}
|
|
275
310
|
if (isFieldLikeTarget(target)) {
|
|
276
311
|
appendGoalIdentityAlias(values, target.label);
|
|
277
312
|
appendGoalIdentityAlias(values, target.displayLabel);
|
|
@@ -646,6 +681,10 @@ function structureLexicalValue(structure) {
|
|
|
646
681
|
return [
|
|
647
682
|
structure.family,
|
|
648
683
|
structure.variant,
|
|
684
|
+
structure.dateIso,
|
|
685
|
+
typeof structure.dateYear === 'number' ? String(structure.dateYear) : undefined,
|
|
686
|
+
typeof structure.dateMonth === 'number' ? String(structure.dateMonth) : undefined,
|
|
687
|
+
typeof structure.dateDay === 'number' ? String(structure.dateDay) : undefined,
|
|
649
688
|
structure.row,
|
|
650
689
|
structure.column,
|
|
651
690
|
structure.zone,
|
|
@@ -1205,6 +1244,7 @@ function buildCompactCandidateSummary(target, index, surfaceSummaryIdBySurfaceKe
|
|
|
1205
1244
|
const surfaceSummaryId = surfaceIdentityOf(target)
|
|
1206
1245
|
? surfaceSummaryIdBySurfaceKey?.get(surfaceIdentityOf(target))
|
|
1207
1246
|
: undefined;
|
|
1247
|
+
const structuredDateIdentity = structuredDateIdentityOf(target.structure);
|
|
1208
1248
|
if (target.kind)
|
|
1209
1249
|
parts.push(`kind=${JSON.stringify(target.kind)}`);
|
|
1210
1250
|
if (target.role)
|
|
@@ -1231,6 +1271,9 @@ function buildCompactCandidateSummary(target, index, surfaceSummaryIdBySurfaceKe
|
|
|
1231
1271
|
if (surfaceSummaryId) {
|
|
1232
1272
|
parts.push(`surface=${surfaceSummaryId}`);
|
|
1233
1273
|
}
|
|
1274
|
+
if (structuredDateIdentity) {
|
|
1275
|
+
parts.push(`date=${JSON.stringify(structuredDateIdentity)}`);
|
|
1276
|
+
}
|
|
1234
1277
|
if (target.structure)
|
|
1235
1278
|
parts.push(`structure=${JSON.stringify(target.structure)}`);
|
|
1236
1279
|
if (target.placeholder)
|
package/dist/library.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { fill, match, resolve, type AgentbrowseFillFailureResult, type AgentbrowseFillOptions, type AgentbrowseFillResult, type AgentbrowseGroupFillHandler, type AgentbrowseMatchApplicability, type AgentbrowseMatchCandidate, type AgentbrowseGroupMatchCandidate, type AgentbrowseMatchOptions, type AgentbrowseMatchResolver, type AgentbrowseMatchResult, type AgentbrowseMatchSource, type AgentbrowseGroupMatchStore, type AgentbrowseMatchStore, type AgentbrowseMatchValue, type AgentbrowseResolvableMatchResult, type AgentbrowseResolvedArtifactResource, type AgentbrowseResolvedResource, type AgentbrowseResolvedValueResource, type AgentbrowseAmbiguousGroupMatchResult, type AgentbrowseAmbiguousMatchResult, type AgentbrowseGroupResolutionPlan, type AgentbrowseNeedsResolutionGroupMatchResult, type AgentbrowseNeedsResolutionMatchResult, type AgentbrowseNoGroupMatchResult, type AgentbrowseNoMatchResult, type AgentbrowseReadyGroupMatchResult, type AgentbrowseReadyGroupFillInput, type AgentbrowseReadyMatchResult, type AgentbrowseResolutionPlan, type AgentbrowseResolveOptions, } from './match-resolve-fill.js';
|
|
2
|
+
export { createBrowserSessionStore, deleteBrowserSession, getSessionPort, isAttachedSession, isOwnedSession, isSessionAlive, loadBrowserSession, resolveBrowserSessionId, saveBrowserSession, serializeBrowserSession, buildAttachedSession, buildOwnedSession, buildStickyOwnerMetadata, canPersistStickyOwnerMetadata, type BrowserSessionStore, type BrowserSessionState, type BrowseSessionIdentity, type BrowseSessionTransport, type StickyOwnerInProcessTransport, type StickyOwnerMetadata, type StickyOwnerPlaywrightBindTransport, type StickyOwnerState, type StickyOwnerTransport, STICKY_OWNER_SCHEMA_VERSION, } from './browser-session-state.js';
|
|
2
3
|
export { attach, ATTACH_ERROR_CODES, ATTACH_OUTCOME_TYPES, type AttachErrorCode, type AttachFailureResult, type AttachOutcomeType, type AttachOptions, type AttachResult, type AttachSuccessResult, } from './commands/attach.js';
|
|
3
4
|
export { AgentbrowseAssistiveRuntimeMissingError, AssistiveStructuredOutputTruncatedError, configureAgentbrowseAssistiveRuntime, resetAgentbrowseAssistiveRuntime, type AgentbrowseAssistiveChatCompletionOptions, type AgentbrowseAssistiveChatCompletionRequest, type AgentbrowseAssistiveChatCompletionResult, type AgentbrowseAssistiveChatMessage, type AgentbrowseAssistiveImageInput, type AgentbrowseAssistiveLlmClient, type AgentbrowseAssistiveLlmUsage, type AgentbrowseAssistiveMessageContentPart, type AgentbrowseAssistiveResponseModel, type AgentbrowseAssistiveRuntime, } from './assistive-runtime.js';
|
|
4
5
|
export { createAgentbrowseClient, type AgentbrowseClient, type AgentbrowseClientOptions, } from './client.js';
|
|
@@ -13,6 +14,7 @@ export { observeBrowser as observe, OBSERVE_ERROR_CODES, OBSERVE_OUTCOME_TYPES,
|
|
|
13
14
|
export { classifyObservePageState, shouldSuppressFillableFormsForObserve, type ObservePageState, } from './commands/observe-page-state.js';
|
|
14
15
|
export { resolveObservedField, type ObservedFieldCandidate, type ObservedFieldValueSource, type ObservedFieldValueType, type ResolveObservedFieldOptions, type ResolveObservedFieldResult, } from './secrets/observed-field-resolution.js';
|
|
15
16
|
export { close, CLOSE_ERROR_CODES, CLOSE_OUTCOME_TYPES, type CloseErrorCode, type CloseFailureResult, type CloseOutcomeType, type CloseResult, type CloseSuccessResult, } from './commands/close.js';
|
|
17
|
+
export { restoreBrowserSessionOwner, type RestoreBrowserSessionOwnerResult, } from './sticky-owner.js';
|
|
16
18
|
export { launch, LAUNCH_ERROR_CODES, LAUNCH_OUTCOME_TYPES, type LaunchErrorCode, type LaunchOptions, type LaunchFailureResult, type LaunchOutcomeType, type LaunchResult, type LaunchSuccessResult, } from './commands/launch.js';
|
|
17
19
|
export { navigateBrowser as navigate, NAVIGATE_ERROR_CODES, NAVIGATE_OUTCOME_TYPES, type NavigateErrorCode, type NavigateFailureResult, type NavigateOutcomeType, type NavigateResult, type NavigateSuccessResult, } from './commands/navigate.js';
|
|
18
20
|
export { screenshotBrowser as screenshot, SCREENSHOT_ERROR_CODES, SCREENSHOT_OUTCOME_TYPES, type ScreenshotErrorCode, type ScreenshotFailureResult, type ScreenshotOutcomeType, type ScreenshotResult, type ScreenshotSuccessResult, } from './commands/screenshot.js';
|
package/dist/library.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,E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,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,IAAI,QAAQ,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,IAAI,UAAU,EAC/B,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/library.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { fill, match, resolve, } from './match-resolve-fill.js';
|
|
2
|
+
export { createBrowserSessionStore, deleteBrowserSession, getSessionPort, isAttachedSession, isOwnedSession, isSessionAlive, loadBrowserSession, resolveBrowserSessionId, saveBrowserSession, serializeBrowserSession, buildAttachedSession, buildOwnedSession, buildStickyOwnerMetadata, canPersistStickyOwnerMetadata, STICKY_OWNER_SCHEMA_VERSION, } from './browser-session-state.js';
|
|
2
3
|
export { attach, ATTACH_ERROR_CODES, ATTACH_OUTCOME_TYPES, } from './commands/attach.js';
|
|
3
4
|
export { AgentbrowseAssistiveRuntimeMissingError, AssistiveStructuredOutputTruncatedError, configureAgentbrowseAssistiveRuntime, resetAgentbrowseAssistiveRuntime, } from './assistive-runtime.js';
|
|
4
5
|
export { createAgentbrowseClient, } from './client.js';
|
|
@@ -11,6 +12,7 @@ export { observeBrowser as observe, OBSERVE_ERROR_CODES, OBSERVE_OUTCOME_TYPES,
|
|
|
11
12
|
export { classifyObservePageState, shouldSuppressFillableFormsForObserve, } from './commands/observe-page-state.js';
|
|
12
13
|
export { resolveObservedField, } from './secrets/observed-field-resolution.js';
|
|
13
14
|
export { close, CLOSE_ERROR_CODES, CLOSE_OUTCOME_TYPES, } from './commands/close.js';
|
|
15
|
+
export { restoreBrowserSessionOwner, } from './sticky-owner.js';
|
|
14
16
|
export { launch, LAUNCH_ERROR_CODES, LAUNCH_OUTCOME_TYPES, } from './commands/launch.js';
|
|
15
17
|
export { navigateBrowser as navigate, NAVIGATE_ERROR_CODES, NAVIGATE_OUTCOME_TYPES, } from './commands/navigate.js';
|
|
16
18
|
export { screenshotBrowser as screenshot, SCREENSHOT_ERROR_CODES, SCREENSHOT_OUTCOME_TYPES, } from './commands/screenshot.js';
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { BrowserCommandSession } from './browser-session-state.js';
|
|
2
|
+
import { type ActResult } from './commands/act.js';
|
|
3
|
+
import { type ObservedFieldValueType } from './secrets/observed-field-resolution.js';
|
|
4
|
+
import type { ProtectedFillForm } from './protected-fill.js';
|
|
5
|
+
import type { TargetDescriptor } from './runtime-state.js';
|
|
6
|
+
export type AgentbrowseMatchValue = string | number;
|
|
7
|
+
export type AgentbrowseMatchApplicability = {
|
|
8
|
+
target: 'global' | 'host';
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
11
|
+
export interface AgentbrowseMatchResolutionRequest {
|
|
12
|
+
kind: string;
|
|
13
|
+
key?: string;
|
|
14
|
+
params?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentbrowseMatchCandidate {
|
|
17
|
+
candidateRef?: string;
|
|
18
|
+
fieldKey: string;
|
|
19
|
+
value?: AgentbrowseMatchValue;
|
|
20
|
+
type?: ObservedFieldValueType;
|
|
21
|
+
label?: string;
|
|
22
|
+
semanticTags?: string[];
|
|
23
|
+
applicability?: AgentbrowseMatchApplicability;
|
|
24
|
+
resolve?: AgentbrowseMatchResolutionRequest;
|
|
25
|
+
}
|
|
26
|
+
export interface AgentbrowseMatchStore {
|
|
27
|
+
entries(): ReadonlyArray<AgentbrowseMatchCandidate>;
|
|
28
|
+
read(candidateRef: string): AgentbrowseMatchValue | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface AgentbrowseGroupMatchCandidate {
|
|
31
|
+
candidateRef?: string;
|
|
32
|
+
itemRef?: string;
|
|
33
|
+
label?: string;
|
|
34
|
+
fieldKeys: ReadonlyArray<string>;
|
|
35
|
+
confidence?: 'high' | 'medium';
|
|
36
|
+
applicability?: AgentbrowseMatchApplicability;
|
|
37
|
+
resolve?: AgentbrowseMatchResolutionRequest;
|
|
38
|
+
artifact?: unknown;
|
|
39
|
+
}
|
|
40
|
+
export interface AgentbrowseGroupMatchStore {
|
|
41
|
+
entries(): ReadonlyArray<AgentbrowseGroupMatchCandidate>;
|
|
42
|
+
readArtifact(candidateRef: string): unknown;
|
|
43
|
+
}
|
|
44
|
+
export type AgentbrowseMatchSource = Record<string, AgentbrowseMatchValue> | ReadonlyArray<AgentbrowseMatchCandidate> | AgentbrowseMatchStore | ReadonlyArray<AgentbrowseGroupMatchCandidate> | AgentbrowseGroupMatchStore;
|
|
45
|
+
export interface AgentbrowseMatchOptions {
|
|
46
|
+
from: AgentbrowseMatchSource;
|
|
47
|
+
host?: string;
|
|
48
|
+
protectedTargetRefs?: ReadonlySet<string>;
|
|
49
|
+
}
|
|
50
|
+
export interface AgentbrowseResolutionPlan {
|
|
51
|
+
targetRef: string;
|
|
52
|
+
candidateRef: string;
|
|
53
|
+
fieldKey: string;
|
|
54
|
+
type?: ObservedFieldValueType;
|
|
55
|
+
resolve: AgentbrowseMatchResolutionRequest;
|
|
56
|
+
}
|
|
57
|
+
export interface AgentbrowseGroupResolutionPlan {
|
|
58
|
+
fillRef: string;
|
|
59
|
+
pageRef: string;
|
|
60
|
+
scopeRef?: string;
|
|
61
|
+
purpose: string;
|
|
62
|
+
candidateRef: string;
|
|
63
|
+
itemRef?: string;
|
|
64
|
+
fieldKeys: ReadonlyArray<string>;
|
|
65
|
+
resolve: AgentbrowseMatchResolutionRequest;
|
|
66
|
+
}
|
|
67
|
+
export type AgentbrowseReadyMatchResult = {
|
|
68
|
+
kind: 'ready';
|
|
69
|
+
targetRef: string;
|
|
70
|
+
fieldKey: string;
|
|
71
|
+
candidateRef: string;
|
|
72
|
+
valueRef: string;
|
|
73
|
+
confidence: 'high' | 'medium';
|
|
74
|
+
};
|
|
75
|
+
export type AgentbrowseNeedsResolutionMatchResult = {
|
|
76
|
+
kind: 'needs_resolution';
|
|
77
|
+
targetRef: string;
|
|
78
|
+
fieldKey: string;
|
|
79
|
+
candidateRef: string;
|
|
80
|
+
confidence: 'high' | 'medium';
|
|
81
|
+
plan: AgentbrowseResolutionPlan;
|
|
82
|
+
};
|
|
83
|
+
export type AgentbrowseReadyGroupMatchResult = {
|
|
84
|
+
kind: 'ready_group';
|
|
85
|
+
fillRef: string;
|
|
86
|
+
purpose: string;
|
|
87
|
+
candidateRef: string;
|
|
88
|
+
itemRef?: string;
|
|
89
|
+
fieldKeys: ReadonlyArray<string>;
|
|
90
|
+
artifactRef: string;
|
|
91
|
+
confidence: 'high' | 'medium';
|
|
92
|
+
requestId?: string;
|
|
93
|
+
resolutionPath?: string;
|
|
94
|
+
claimedAt?: string;
|
|
95
|
+
};
|
|
96
|
+
export type AgentbrowseNeedsResolutionGroupMatchResult = {
|
|
97
|
+
kind: 'needs_resolution_group';
|
|
98
|
+
fillRef: string;
|
|
99
|
+
purpose: string;
|
|
100
|
+
candidateRef: string;
|
|
101
|
+
itemRef?: string;
|
|
102
|
+
fieldKeys: ReadonlyArray<string>;
|
|
103
|
+
confidence: 'high' | 'medium';
|
|
104
|
+
plan: AgentbrowseGroupResolutionPlan;
|
|
105
|
+
};
|
|
106
|
+
export type AgentbrowseAmbiguousGroupMatchResult = {
|
|
107
|
+
kind: 'ambiguous_group';
|
|
108
|
+
fillRef: string;
|
|
109
|
+
candidates: string[];
|
|
110
|
+
};
|
|
111
|
+
export type AgentbrowseNoGroupMatchResult = {
|
|
112
|
+
kind: 'no_match_group';
|
|
113
|
+
fillRef: string;
|
|
114
|
+
reason: 'no_candidate' | 'scope_ineligible' | 'incompatible_shape' | 'low_confidence';
|
|
115
|
+
};
|
|
116
|
+
export type AgentbrowseAmbiguousMatchResult = {
|
|
117
|
+
kind: 'ambiguous';
|
|
118
|
+
targetRef: string;
|
|
119
|
+
candidates: string[];
|
|
120
|
+
};
|
|
121
|
+
export type AgentbrowseNoMatchResult = {
|
|
122
|
+
kind: 'no_match';
|
|
123
|
+
targetRef: string;
|
|
124
|
+
reason: 'protected_target' | 'no_candidate' | 'scope_ineligible' | 'incompatible_shape' | 'low_confidence';
|
|
125
|
+
};
|
|
126
|
+
export type AgentbrowseMatchResult = AgentbrowseReadyMatchResult | AgentbrowseNeedsResolutionMatchResult | AgentbrowseAmbiguousMatchResult | AgentbrowseNoMatchResult | AgentbrowseReadyGroupMatchResult | AgentbrowseNeedsResolutionGroupMatchResult | AgentbrowseAmbiguousGroupMatchResult | AgentbrowseNoGroupMatchResult;
|
|
127
|
+
export type AgentbrowseResolvableMatchResult = AgentbrowseNeedsResolutionMatchResult | AgentbrowseNeedsResolutionGroupMatchResult;
|
|
128
|
+
export type AgentbrowseResolvedValueResource = {
|
|
129
|
+
kind: 'value';
|
|
130
|
+
value: AgentbrowseMatchValue;
|
|
131
|
+
};
|
|
132
|
+
export type AgentbrowseResolvedArtifactResource = {
|
|
133
|
+
kind: 'artifact';
|
|
134
|
+
artifact: unknown;
|
|
135
|
+
itemRef?: string;
|
|
136
|
+
requestId?: string;
|
|
137
|
+
resolutionPath?: string;
|
|
138
|
+
claimedAt?: string;
|
|
139
|
+
};
|
|
140
|
+
export type AgentbrowseResolvedResource = AgentbrowseResolvedValueResource | AgentbrowseResolvedArtifactResource;
|
|
141
|
+
export interface AgentbrowseReadyGroupFillInput {
|
|
142
|
+
candidateRef: string;
|
|
143
|
+
itemRef?: string;
|
|
144
|
+
fieldKeys: ReadonlyArray<string>;
|
|
145
|
+
artifact: unknown;
|
|
146
|
+
requestId?: string;
|
|
147
|
+
resolutionPath?: string;
|
|
148
|
+
claimedAt?: string;
|
|
149
|
+
}
|
|
150
|
+
export interface AgentbrowseGroupFillHandler {
|
|
151
|
+
fill(session: BrowserCommandSession, subject: ProtectedFillForm, ready: AgentbrowseReadyGroupFillInput): Promise<Record<string, unknown> & {
|
|
152
|
+
success: boolean;
|
|
153
|
+
}>;
|
|
154
|
+
}
|
|
155
|
+
export interface AgentbrowseMatchResolver {
|
|
156
|
+
resolve(plan: AgentbrowseResolutionPlan | AgentbrowseGroupResolutionPlan): Promise<AgentbrowseResolvedResource>;
|
|
157
|
+
resolveBatch?(plans: ReadonlyArray<AgentbrowseResolutionPlan | AgentbrowseGroupResolutionPlan>): Promise<ReadonlyArray<AgentbrowseResolvedResource>>;
|
|
158
|
+
fill?(session: BrowserCommandSession, subject: ProtectedFillForm, ready: AgentbrowseReadyGroupFillInput): Promise<Record<string, unknown> & {
|
|
159
|
+
success: boolean;
|
|
160
|
+
}>;
|
|
161
|
+
}
|
|
162
|
+
export interface AgentbrowseResolveOptions {
|
|
163
|
+
with: AgentbrowseMatchResolver;
|
|
164
|
+
}
|
|
165
|
+
export interface AgentbrowseFillOptions {
|
|
166
|
+
resolver?: AgentbrowseMatchResolver | AgentbrowseGroupFillHandler;
|
|
167
|
+
}
|
|
168
|
+
export type AgentbrowseFillFailureResult = {
|
|
169
|
+
success: false;
|
|
170
|
+
failureSurface: 'contract';
|
|
171
|
+
error: 'match_no_match' | 'match_ambiguous' | 'match_resolver_required' | 'match_value_unavailable' | 'match_artifact_unavailable';
|
|
172
|
+
outcomeType: 'blocked' | 'unsupported';
|
|
173
|
+
message: string;
|
|
174
|
+
reason: string;
|
|
175
|
+
targetRef?: string;
|
|
176
|
+
fillRef?: string;
|
|
177
|
+
action: 'fill';
|
|
178
|
+
};
|
|
179
|
+
export type AgentbrowseFillResult = ActResult | AgentbrowseFillFailureResult | (Record<string, unknown> & {
|
|
180
|
+
success: boolean;
|
|
181
|
+
});
|
|
182
|
+
type MatchableTarget = {
|
|
183
|
+
ref: string;
|
|
184
|
+
} & Partial<Pick<TargetDescriptor, 'pageRef' | 'kind' | 'label' | 'displayLabel' | 'placeholder' | 'inputName' | 'inputType' | 'autocomplete' | 'selection' | 'structure' | 'capability'>> & {
|
|
185
|
+
context?: TargetDescriptor['context'] | string;
|
|
186
|
+
availability?: TargetDescriptor['availability'] | string;
|
|
187
|
+
lifecycle?: TargetDescriptor['lifecycle'];
|
|
188
|
+
allowedActions?: TargetDescriptor['allowedActions'];
|
|
189
|
+
};
|
|
190
|
+
type MatchableGroup = Pick<ProtectedFillForm, 'fillRef' | 'pageRef' | 'scopeRef' | 'purpose' | 'fields' | 'observedAt' | 'presence'>;
|
|
191
|
+
export declare function match(subject: MatchableTarget | MatchableGroup, options: AgentbrowseMatchOptions): Promise<AgentbrowseMatchResult>;
|
|
192
|
+
export declare function resolve(plan: ReadonlyArray<AgentbrowseMatchResult>, options: AgentbrowseResolveOptions): Promise<AgentbrowseMatchResult[]>;
|
|
193
|
+
export declare function resolve(plan: AgentbrowseMatchResult, options: AgentbrowseResolveOptions): Promise<AgentbrowseMatchResult>;
|
|
194
|
+
export declare function fill(session: BrowserCommandSession, subject: Pick<TargetDescriptor, 'ref'> | ProtectedFillForm, plan: AgentbrowseMatchResult, options?: AgentbrowseFillOptions): Promise<AgentbrowseFillResult>;
|
|
195
|
+
export {};
|
|
196
|
+
//# sourceMappingURL=match-resolve-fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-resolve-fill.d.ts","sourceRoot":"","sources":["../src/match-resolve-fill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAGL,KAAK,sBAAsB,EAC5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