@anvailabs/agentbrowser-mcp 1.8.19 → 1.9.0
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/dist/bin.js +219 -28
- package/dist/index.js +92 -24
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -7434,11 +7434,21 @@ var AGENT_CAPABILITIES = Object.freeze([
|
|
|
7434
7434
|
"page.interact",
|
|
7435
7435
|
"page.form",
|
|
7436
7436
|
"page.extract",
|
|
7437
|
-
"page.capture"
|
|
7437
|
+
"page.capture",
|
|
7438
|
+
"application.discover",
|
|
7439
|
+
"application.execute"
|
|
7438
7440
|
]);
|
|
7439
|
-
var
|
|
7440
|
-
|
|
7441
|
-
|
|
7441
|
+
var APPLICATION_CAPABILITIES = [
|
|
7442
|
+
"application.discover",
|
|
7443
|
+
"application.execute"
|
|
7444
|
+
];
|
|
7445
|
+
var BROWSER_PROFILE = AGENT_CAPABILITIES.filter((capability) => !APPLICATION_CAPABILITIES.includes(capability));
|
|
7446
|
+
var FULL_BROWSER_PROFILE = BROWSER_PROFILE;
|
|
7447
|
+
var AUDIT_PROFILE = BROWSER_PROFILE.filter((capability) => capability !== "page.form");
|
|
7448
|
+
var APPLICATION_PROFILE = [
|
|
7449
|
+
"session.control",
|
|
7450
|
+
...APPLICATION_CAPABILITIES
|
|
7451
|
+
];
|
|
7442
7452
|
var profiles = Object.freeze({
|
|
7443
7453
|
qa: profile("qa", FULL_BROWSER_PROFILE),
|
|
7444
7454
|
operations: profile("operations", FULL_BROWSER_PROFILE),
|
|
@@ -7462,6 +7472,14 @@ function agentModeAllows(mode, capability) {
|
|
|
7462
7472
|
}
|
|
7463
7473
|
|
|
7464
7474
|
// ../protocol/dist/control.js
|
|
7475
|
+
var strict = { additionalProperties: false };
|
|
7476
|
+
var OPERATION_ID_PATTERN = "^[a-zA-Z0-9_-]{1,128}$";
|
|
7477
|
+
var CONTROL_OPERATION_ID = new RegExp(OPERATION_ID_PATTERN);
|
|
7478
|
+
var OperationIdSchema = Type.String({
|
|
7479
|
+
minLength: 1,
|
|
7480
|
+
maxLength: 128,
|
|
7481
|
+
pattern: OPERATION_ID_PATTERN
|
|
7482
|
+
});
|
|
7465
7483
|
var ControlStateSchema = Type.Union([
|
|
7466
7484
|
Type.Literal("HUMAN_ACTIVE"),
|
|
7467
7485
|
Type.Literal("RESUME_REVIEW"),
|
|
@@ -7470,8 +7488,8 @@ var ControlStateSchema = Type.Union([
|
|
|
7470
7488
|
Type.Literal("STOPPED")
|
|
7471
7489
|
]);
|
|
7472
7490
|
var OperationRecordSchema = Type.Object({
|
|
7473
|
-
operationId:
|
|
7474
|
-
epoch: Type.Integer(),
|
|
7491
|
+
operationId: OperationIdSchema,
|
|
7492
|
+
epoch: Type.Integer({ minimum: 0 }),
|
|
7475
7493
|
status: Type.Union([
|
|
7476
7494
|
Type.Literal("in_flight"),
|
|
7477
7495
|
Type.Literal("completed"),
|
|
@@ -7479,7 +7497,8 @@ var OperationRecordSchema = Type.Object({
|
|
|
7479
7497
|
Type.Literal("outcome_unknown")
|
|
7480
7498
|
]),
|
|
7481
7499
|
dispatched: Type.Boolean()
|
|
7482
|
-
});
|
|
7500
|
+
}, strict);
|
|
7501
|
+
var OperationReplaySchema = Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, { ...strict, $id: "urn:agentbrowser:operation-replay:v1" });
|
|
7483
7502
|
var RunCursorSchema = Type.Object({
|
|
7484
7503
|
version: Type.Literal(1),
|
|
7485
7504
|
serviceGeneration: Type.String({ pattern: "^[A-Za-z0-9_-]{22}$" }),
|
|
@@ -7496,6 +7515,13 @@ var ControlViewSchema = Type.Object({
|
|
|
7496
7515
|
operation: Type.Optional(OperationRecordSchema),
|
|
7497
7516
|
cursor: Type.Optional(RunCursorSchema)
|
|
7498
7517
|
});
|
|
7518
|
+
function parseOperationReplay(input) {
|
|
7519
|
+
return parseExecutionReport(OperationReplaySchema, input, "operation replay", void 0, {
|
|
7520
|
+
maxDepth: 4,
|
|
7521
|
+
maxNodes: 32,
|
|
7522
|
+
maxBytes: 4096
|
|
7523
|
+
});
|
|
7524
|
+
}
|
|
7499
7525
|
var ControlReviewSchema = Type.Intersect([
|
|
7500
7526
|
ControlViewSchema,
|
|
7501
7527
|
Type.Object({
|
|
@@ -7513,21 +7539,51 @@ var ControlGrantSchema = Type.Intersect([
|
|
|
7513
7539
|
Type.Object({ token: Type.String(), mode: AgentModeSchema, cursor: RunCursorSchema })
|
|
7514
7540
|
]);
|
|
7515
7541
|
|
|
7542
|
+
// ../protocol/dist/application.js
|
|
7543
|
+
var strict2 = { additionalProperties: false };
|
|
7544
|
+
var ID_SCHEMA = OperationIdSchema;
|
|
7545
|
+
var ApplicationBindingSchema = Type.Object({ adapter: ID_SCHEMA, resource: ID_SCHEMA }, strict2);
|
|
7546
|
+
var ApplicationOperationDescriptorSchema = Type.Object({
|
|
7547
|
+
name: ID_SCHEMA,
|
|
7548
|
+
mode: Type.Union([Type.Literal("read"), Type.Literal("write")])
|
|
7549
|
+
}, strict2);
|
|
7550
|
+
var ApplicationDiscoverySchema = Type.Object({
|
|
7551
|
+
adapter: Type.String(),
|
|
7552
|
+
resource: Type.String(),
|
|
7553
|
+
operations: Type.Array(ApplicationOperationDescriptorSchema, { maxItems: 256 })
|
|
7554
|
+
}, strict2);
|
|
7555
|
+
var ApplicationExecuteRequestSchema = Type.Object({
|
|
7556
|
+
operation: ID_SCHEMA,
|
|
7557
|
+
input: Type.Unknown(),
|
|
7558
|
+
operationId: Type.Optional(ID_SCHEMA),
|
|
7559
|
+
expectedVersion: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
7560
|
+
}, strict2);
|
|
7561
|
+
var ApplicationOperationResultSchema = Type.Union([
|
|
7562
|
+
Type.Object({
|
|
7563
|
+
status: Type.Union([Type.Literal("read"), Type.Literal("committed")]),
|
|
7564
|
+
value: Type.Unknown()
|
|
7565
|
+
}, strict2),
|
|
7566
|
+
Type.Object({ status: Type.Literal("rejected"), reason: Type.String() }, strict2),
|
|
7567
|
+
Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, strict2)
|
|
7568
|
+
]);
|
|
7569
|
+
var binding = TypeCompiler.Compile(ApplicationBindingSchema);
|
|
7570
|
+
var execute = TypeCompiler.Compile(ApplicationExecuteRequestSchema);
|
|
7571
|
+
|
|
7516
7572
|
// ../protocol/dist/autofill.js
|
|
7517
7573
|
var text = () => Type.String({ minLength: 1, maxLength: 512 });
|
|
7518
|
-
var
|
|
7574
|
+
var strict3 = { additionalProperties: false };
|
|
7519
7575
|
var AutofillMatchSchema = Type.Object({
|
|
7520
7576
|
role: Type.Optional(text()),
|
|
7521
7577
|
label: Type.Optional(text()),
|
|
7522
7578
|
labelRegex: Type.Optional(text()),
|
|
7523
7579
|
dataAutomationId: Type.Optional(text()),
|
|
7524
|
-
block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...
|
|
7525
|
-
}, { ...
|
|
7580
|
+
block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict3, minProperties: 1 }))
|
|
7581
|
+
}, { ...strict3, minProperties: 1 });
|
|
7526
7582
|
var AutofillRequestSchema = Type.Object({
|
|
7527
7583
|
fields: Type.Array(Type.Object({
|
|
7528
7584
|
match: AutofillMatchSchema,
|
|
7529
7585
|
value: Type.Optional(Type.String({ maxLength: 8192 })),
|
|
7530
|
-
option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) },
|
|
7586
|
+
option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict3)),
|
|
7531
7587
|
verify: Type.Optional(Type.Union([Type.Literal("exact"), Type.Literal("none")])),
|
|
7532
7588
|
strategy: Type.Optional(Type.Union([
|
|
7533
7589
|
Type.Literal("native-input"),
|
|
@@ -7535,15 +7591,15 @@ var AutofillRequestSchema = Type.Object({
|
|
|
7535
7591
|
Type.Literal("react-select"),
|
|
7536
7592
|
Type.Literal("chip-multiselect")
|
|
7537
7593
|
]))
|
|
7538
|
-
},
|
|
7594
|
+
}, strict3), { minItems: 1, maxItems: 50 }),
|
|
7539
7595
|
policy: Type.Optional(Type.Object({
|
|
7540
7596
|
onAmbiguous: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip")])),
|
|
7541
7597
|
onVerifyFail: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip"), Type.Literal("retry")])),
|
|
7542
7598
|
maxReobserve: Type.Optional(Type.Integer({ minimum: 0, maximum: 5 })),
|
|
7543
7599
|
settleMs: Type.Optional(Type.Integer({ minimum: 0, maximum: 2e3 })),
|
|
7544
7600
|
timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 24e4 }))
|
|
7545
|
-
},
|
|
7546
|
-
},
|
|
7601
|
+
}, strict3))
|
|
7602
|
+
}, strict3);
|
|
7547
7603
|
var AutofillReceiptSchema = Type.Object({
|
|
7548
7604
|
field: Type.Integer({ minimum: 0, maximum: 49 }),
|
|
7549
7605
|
match: AutofillMatchSchema,
|
|
@@ -7554,8 +7610,8 @@ var AutofillReceiptSchema = Type.Object({
|
|
|
7554
7610
|
verified: Type.Boolean(),
|
|
7555
7611
|
actual: Type.Optional(Type.String({ maxLength: 512 })),
|
|
7556
7612
|
actualTruncated: Type.Optional(Type.Boolean()),
|
|
7557
|
-
error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() },
|
|
7558
|
-
},
|
|
7613
|
+
error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict3))
|
|
7614
|
+
}, strict3);
|
|
7559
7615
|
var AutofillReportSchema = Type.Object({
|
|
7560
7616
|
ok: Type.Boolean(),
|
|
7561
7617
|
receipts: Type.Array(AutofillReceiptSchema, { maxItems: 50 }),
|
|
@@ -7565,9 +7621,9 @@ var AutofillReportSchema = Type.Object({
|
|
|
7565
7621
|
contentType: Type.Optional(Type.String()),
|
|
7566
7622
|
sizeBytes: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
7567
7623
|
warnings: Type.Optional(Type.Array(Type.String()))
|
|
7568
|
-
},
|
|
7624
|
+
}, strict3)),
|
|
7569
7625
|
snapshotError: Type.Optional(Type.String())
|
|
7570
|
-
}, { ...
|
|
7626
|
+
}, { ...strict3, $id: "urn:agentbrowser:autofill-report:v1" });
|
|
7571
7627
|
function labelPattern(pattern) {
|
|
7572
7628
|
const start = pattern.startsWith("^");
|
|
7573
7629
|
const end = pattern.endsWith("$");
|
|
@@ -7673,7 +7729,7 @@ function createPlanReportParser(actions) {
|
|
|
7673
7729
|
}
|
|
7674
7730
|
|
|
7675
7731
|
// ../protocol/dist/outcome.js
|
|
7676
|
-
var
|
|
7732
|
+
var strict4 = { additionalProperties: false };
|
|
7677
7733
|
var identifier = () => Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9][A-Za-z0-9._-]*$" });
|
|
7678
7734
|
var GROUNDING_LAYERS = Object.freeze(["G0", "G1", "G2", "G3", "G4", "G5", "G6"]);
|
|
7679
7735
|
var GroundingLayerSchema = Type.Union([
|
|
@@ -7698,11 +7754,11 @@ var VerificationProjectionSchema = Type.Object({
|
|
|
7698
7754
|
Type.Literal("unknown"),
|
|
7699
7755
|
Type.Literal("not_requested")
|
|
7700
7756
|
]),
|
|
7701
|
-
verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() },
|
|
7757
|
+
verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() }, strict4)),
|
|
7702
7758
|
requiredLayer: GroundingLayerSchema,
|
|
7703
7759
|
achievedLayer: Type.Optional(GroundingLayerSchema),
|
|
7704
7760
|
evidenceRefIds: EvidenceReferenceIdsSchema
|
|
7705
|
-
},
|
|
7761
|
+
}, strict4);
|
|
7706
7762
|
var OutcomeProjectionSchema = Type.Object({
|
|
7707
7763
|
availability: Type.Union([
|
|
7708
7764
|
Type.Literal("available"),
|
|
@@ -7729,7 +7785,24 @@ var OutcomeProjectionSchema = Type.Object({
|
|
|
7729
7785
|
Type.Literal("application"),
|
|
7730
7786
|
Type.Literal("agent_tool")
|
|
7731
7787
|
])
|
|
7732
|
-
},
|
|
7788
|
+
}, strict4);
|
|
7789
|
+
var evidenceCorrelationIdSchema = {
|
|
7790
|
+
...OperationIdSchema,
|
|
7791
|
+
description: "Business receipt operation ID for an opted-in trusted evidence source; distinct from the service operation ID and conveys no authority."
|
|
7792
|
+
};
|
|
7793
|
+
var OutcomeRunRequestSchema = Type.Object({
|
|
7794
|
+
// A UI outcome must exercise the UI seam; an empty plan cannot attest it.
|
|
7795
|
+
actions: Type.Array(PlanStepSchema, { minItems: 1 }),
|
|
7796
|
+
verification: Type.Object({
|
|
7797
|
+
verifier: Type.Object({ id: identifier(), version: identifier() }, strict4),
|
|
7798
|
+
input: Type.Unknown(),
|
|
7799
|
+
evidenceCorrelationId: Type.Optional(evidenceCorrelationIdSchema)
|
|
7800
|
+
}, strict4)
|
|
7801
|
+
}, { ...strict4, $id: "urn:agentbrowser:outcome-run-request:v1" });
|
|
7802
|
+
var OutcomeRunReportSchema = Type.Object({
|
|
7803
|
+
plan: PlanReportSchema,
|
|
7804
|
+
outcome: OutcomeProjectionSchema
|
|
7805
|
+
}, { ...strict4, $id: "urn:agentbrowser:outcome-run-report:v1" });
|
|
7733
7806
|
var TrustedVerifierDescriptorSchema = Type.Object({
|
|
7734
7807
|
id: identifier(),
|
|
7735
7808
|
version: identifier(),
|
|
@@ -7741,12 +7814,68 @@ var TrustedVerifierDescriptorSchema = Type.Object({
|
|
|
7741
7814
|
budget: Type.Object({
|
|
7742
7815
|
maxReads: Type.Integer({ minimum: 1, maximum: 100 }),
|
|
7743
7816
|
timeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
|
|
7817
|
+
pollIntervalMs: Type.Integer({ minimum: 1, maximum: 1e4 }),
|
|
7818
|
+
cleanupTimeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
|
|
7744
7819
|
maxEvidenceRefs: Type.Integer({ minimum: 1, maximum: 32 })
|
|
7745
|
-
},
|
|
7820
|
+
}, strict4),
|
|
7746
7821
|
redaction: Type.Literal("reference_only"),
|
|
7747
7822
|
unsupported: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), { maxItems: 16 }),
|
|
7748
7823
|
cleanup: Type.Union([Type.Literal("not_needed"), Type.Literal("required")])
|
|
7749
|
-
},
|
|
7824
|
+
}, strict4);
|
|
7825
|
+
var layer = (value) => GROUNDING_LAYERS.indexOf(value);
|
|
7826
|
+
function validVerification(value) {
|
|
7827
|
+
if (value.status === "not_requested")
|
|
7828
|
+
return value.verifier === void 0 && value.achievedLayer === void 0 && value.evidenceRefIds.length === 0;
|
|
7829
|
+
if (!value.verifier)
|
|
7830
|
+
return false;
|
|
7831
|
+
if (value.status === "unknown")
|
|
7832
|
+
return true;
|
|
7833
|
+
if (value.achievedLayer === void 0 || value.evidenceRefIds.length === 0)
|
|
7834
|
+
return false;
|
|
7835
|
+
return value.status !== "passed" || layer(value.achievedLayer) >= layer(value.requiredLayer);
|
|
7836
|
+
}
|
|
7837
|
+
function parseOutcomeProjection(input) {
|
|
7838
|
+
return parseExecutionReport(OutcomeProjectionSchema, input, "outcome projection", (outcome) => validVerification(outcome.verification), VERIFICATION_SNAPSHOT_LIMITS);
|
|
7839
|
+
}
|
|
7840
|
+
function parseOutcomeRunRequest(input) {
|
|
7841
|
+
return parseExecutionReport(OutcomeRunRequestSchema, input, "outcome run request", void 0, VERIFICATION_SNAPSHOT_LIMITS);
|
|
7842
|
+
}
|
|
7843
|
+
function validRunAxes(plan, outcome) {
|
|
7844
|
+
if (plan.ok !== (outcome.execution === "completed"))
|
|
7845
|
+
return false;
|
|
7846
|
+
if (!plan.ok && outcome.execution !== "failed" && outcome.execution !== "unknown") {
|
|
7847
|
+
const unavailableBeforeExecution = outcome.execution === "not_started" && outcome.availability !== "available" && plan.completed === 0 && plan.results.length === 0;
|
|
7848
|
+
if (!unavailableBeforeExecution)
|
|
7849
|
+
return false;
|
|
7850
|
+
}
|
|
7851
|
+
return outcome.verification.status !== "passed" || outcome.execution === "completed";
|
|
7852
|
+
}
|
|
7853
|
+
function invalidOutcomeRunReport() {
|
|
7854
|
+
throw new Error(`Invalid outcome run report. ${INTERACTION_GUIDANCE.uncertainWrite}`);
|
|
7855
|
+
}
|
|
7856
|
+
function parseRunReport(input, parsePlan, verifier) {
|
|
7857
|
+
const report = parseExecutionReport(OutcomeRunReportSchema, input, "outcome run report", void 0, VERIFICATION_SNAPSHOT_LIMITS);
|
|
7858
|
+
let plan;
|
|
7859
|
+
let outcome;
|
|
7860
|
+
try {
|
|
7861
|
+
plan = parsePlan(report.plan);
|
|
7862
|
+
outcome = parseOutcomeProjection(report.outcome);
|
|
7863
|
+
} catch {
|
|
7864
|
+
return invalidOutcomeRunReport();
|
|
7865
|
+
}
|
|
7866
|
+
if (!validRunAxes(plan, outcome))
|
|
7867
|
+
return invalidOutcomeRunReport();
|
|
7868
|
+
if (verifier !== void 0 && (outcome.verification.verifier?.id !== verifier.id || outcome.verification.verifier.version !== verifier.version)) {
|
|
7869
|
+
return invalidOutcomeRunReport();
|
|
7870
|
+
}
|
|
7871
|
+
return { plan, outcome };
|
|
7872
|
+
}
|
|
7873
|
+
function createOutcomeRunReportParser(request) {
|
|
7874
|
+
const snapshot = parseOutcomeRunRequest(request);
|
|
7875
|
+
const parsePlan = createPlanReportParser(snapshot.actions);
|
|
7876
|
+
const verifier = Object.freeze({ ...snapshot.verification.verifier });
|
|
7877
|
+
return (input) => parseRunReport(input, parsePlan, verifier);
|
|
7878
|
+
}
|
|
7750
7879
|
|
|
7751
7880
|
// ../sdk-typescript/dist/client.js
|
|
7752
7881
|
var AgentBrowserError = class extends Error {
|
|
@@ -7775,7 +7904,13 @@ var HttpClient = class {
|
|
|
7775
7904
|
this.headers = headers;
|
|
7776
7905
|
}
|
|
7777
7906
|
async requestJson(path, init = {}) {
|
|
7778
|
-
const operationId = path.startsWith("/v1/sessions/") && !path.includes("/control") &&
|
|
7907
|
+
const operationId = path.startsWith("/v1/sessions/") && !path.includes("/control") && // Application routes carry their operation identity in the BODY
|
|
7908
|
+
// (deduplicated and fingerprinted by the ApplicationAuthority); the
|
|
7909
|
+
// server ignores the header there. Deriving one here would mint a
|
|
7910
|
+
// random UUID, poison error details with a phantom ID, and make the
|
|
7911
|
+
// replay guard reject legitimate application replays whose recorded
|
|
7912
|
+
// operation ID can never equal a locally minted UUID.
|
|
7913
|
+
!path.includes("/application") && init.method && init.method !== "GET" ? init.operationId ?? this.headers["x-agentbrowser-operation-id"] ?? crypto.randomUUID() : void 0;
|
|
7779
7914
|
const controller = new AbortController();
|
|
7780
7915
|
const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs ?? this.timeoutMs);
|
|
7781
7916
|
try {
|
|
@@ -7810,13 +7945,24 @@ var HttpClient = class {
|
|
|
7810
7945
|
throw new AgentBrowserError(error2.code, error2.message, error2.retryable, { ...error2.details, ...operationId ? { operationId } : {} }, error2.action, error2.traceId);
|
|
7811
7946
|
}
|
|
7812
7947
|
const result = await response.json();
|
|
7813
|
-
|
|
7814
|
-
|
|
7948
|
+
const invalidResponse = () => new AgentBrowserError("INVALID_RESPONSE", `Invalid operation response. ${INTERACTION_GUIDANCE.uncertainWrite}`, false, operationId ? { operationId } : void 0);
|
|
7949
|
+
const replayShaped = typeof result === "object" && result !== null && !Array.isArray(result) && Object.hasOwn(result, "replay") && result.replay === true;
|
|
7950
|
+
if (operationId && replayShaped) {
|
|
7951
|
+
let replay;
|
|
7952
|
+
try {
|
|
7953
|
+
replay = parseOperationReplay(result);
|
|
7954
|
+
} catch {
|
|
7955
|
+
throw invalidResponse();
|
|
7956
|
+
}
|
|
7957
|
+
if (replay.operation.operationId !== operationId)
|
|
7958
|
+
throw invalidResponse();
|
|
7959
|
+
throw new AgentBrowserError("OPERATION_RECORDED", "Operation already recorded; reconcile its status before taking further action", false, { operationId, operation: replay.operation });
|
|
7960
|
+
}
|
|
7815
7961
|
if (init.parseResponse) {
|
|
7816
7962
|
try {
|
|
7817
7963
|
return init.parseResponse(result);
|
|
7818
7964
|
} catch {
|
|
7819
|
-
throw
|
|
7965
|
+
throw invalidResponse();
|
|
7820
7966
|
}
|
|
7821
7967
|
}
|
|
7822
7968
|
return result;
|
|
@@ -7857,6 +8003,41 @@ var SessionsClient = class {
|
|
|
7857
8003
|
async operation(sessionId, operationId) {
|
|
7858
8004
|
return this.http.requestJson(`/v1/sessions/${sessionId}/operations/${encodeURIComponent(operationId)}`);
|
|
7859
8005
|
}
|
|
8006
|
+
/** Operator: bind an application adapter to a resource while the human owns the session. */
|
|
8007
|
+
async applicationBind(sessionId, binding2) {
|
|
8008
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/application`, {
|
|
8009
|
+
method: "PUT",
|
|
8010
|
+
body: binding2
|
|
8011
|
+
});
|
|
8012
|
+
}
|
|
8013
|
+
/**
|
|
8014
|
+
* Operator: drop the binding. Like bind, this requires the human to own
|
|
8015
|
+
* the session - it takes control as a side effect (bumping the control
|
|
8016
|
+
* epoch and invalidating a prepared review) even when nothing is bound.
|
|
8017
|
+
*/
|
|
8018
|
+
async applicationUnbind(sessionId) {
|
|
8019
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/application`, { method: "DELETE" });
|
|
8020
|
+
}
|
|
8021
|
+
/** The bound adapter's operations, or null when nothing is bound. */
|
|
8022
|
+
async applicationDiscover(sessionId) {
|
|
8023
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/application`);
|
|
8024
|
+
}
|
|
8025
|
+
/**
|
|
8026
|
+
* Dispatch one application operation. Writes need operationId +
|
|
8027
|
+
* expectedVersion; a repeated operationId returns the recorded
|
|
8028
|
+
* operation (`replay: true`) instead of re-executing - the retry-safe
|
|
8029
|
+
* path. Read operations must not carry either identity.
|
|
8030
|
+
*/
|
|
8031
|
+
async applicationExecute(sessionId, request) {
|
|
8032
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/application/execute`, {
|
|
8033
|
+
method: "POST",
|
|
8034
|
+
body: request
|
|
8035
|
+
});
|
|
8036
|
+
}
|
|
8037
|
+
/** Read one application receipt by operation ID; null when the adapter has none. */
|
|
8038
|
+
async applicationReceipt(sessionId, operationId) {
|
|
8039
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/application/receipts/${encodeURIComponent(operationId)}`);
|
|
8040
|
+
}
|
|
7860
8041
|
async listPages(sessionId) {
|
|
7861
8042
|
const result = await this.http.requestJson(`/v1/sessions/${sessionId}/pages`);
|
|
7862
8043
|
return result.pages;
|
|
@@ -7946,6 +8127,16 @@ var SessionsClient = class {
|
|
|
7946
8127
|
parseResponse
|
|
7947
8128
|
});
|
|
7948
8129
|
}
|
|
8130
|
+
/** Execute one existing plan and verify its outcome through a trusted server source. */
|
|
8131
|
+
async outcome(sessionId, pageId, request, options = {}) {
|
|
8132
|
+
const parseResponse = createOutcomeRunReportParser(request);
|
|
8133
|
+
return this.http.requestJson(`/v1/sessions/${sessionId}/pages/${pageId}/outcomes`, {
|
|
8134
|
+
method: "POST",
|
|
8135
|
+
body: request,
|
|
8136
|
+
...options,
|
|
8137
|
+
parseResponse
|
|
8138
|
+
});
|
|
8139
|
+
}
|
|
7949
8140
|
/** TD-BROWSER-8: self-contained snapshot payload for one-shot LLM reasoning. */
|
|
7950
8141
|
async snapshot(sessionId, pageId, bounds) {
|
|
7951
8142
|
const query = new URLSearchParams();
|
package/dist/index.js
CHANGED
|
@@ -7430,11 +7430,21 @@ var AGENT_CAPABILITIES = Object.freeze([
|
|
|
7430
7430
|
"page.interact",
|
|
7431
7431
|
"page.form",
|
|
7432
7432
|
"page.extract",
|
|
7433
|
-
"page.capture"
|
|
7433
|
+
"page.capture",
|
|
7434
|
+
"application.discover",
|
|
7435
|
+
"application.execute"
|
|
7434
7436
|
]);
|
|
7435
|
-
var
|
|
7436
|
-
|
|
7437
|
-
|
|
7437
|
+
var APPLICATION_CAPABILITIES = [
|
|
7438
|
+
"application.discover",
|
|
7439
|
+
"application.execute"
|
|
7440
|
+
];
|
|
7441
|
+
var BROWSER_PROFILE = AGENT_CAPABILITIES.filter((capability) => !APPLICATION_CAPABILITIES.includes(capability));
|
|
7442
|
+
var FULL_BROWSER_PROFILE = BROWSER_PROFILE;
|
|
7443
|
+
var AUDIT_PROFILE = BROWSER_PROFILE.filter((capability) => capability !== "page.form");
|
|
7444
|
+
var APPLICATION_PROFILE = [
|
|
7445
|
+
"session.control",
|
|
7446
|
+
...APPLICATION_CAPABILITIES
|
|
7447
|
+
];
|
|
7438
7448
|
var profiles = Object.freeze({
|
|
7439
7449
|
qa: profile("qa", FULL_BROWSER_PROFILE),
|
|
7440
7450
|
operations: profile("operations", FULL_BROWSER_PROFILE),
|
|
@@ -7455,6 +7465,14 @@ function agentModeAllows(mode, capability) {
|
|
|
7455
7465
|
}
|
|
7456
7466
|
|
|
7457
7467
|
// ../protocol/dist/control.js
|
|
7468
|
+
var strict = { additionalProperties: false };
|
|
7469
|
+
var OPERATION_ID_PATTERN = "^[a-zA-Z0-9_-]{1,128}$";
|
|
7470
|
+
var CONTROL_OPERATION_ID = new RegExp(OPERATION_ID_PATTERN);
|
|
7471
|
+
var OperationIdSchema = Type.String({
|
|
7472
|
+
minLength: 1,
|
|
7473
|
+
maxLength: 128,
|
|
7474
|
+
pattern: OPERATION_ID_PATTERN
|
|
7475
|
+
});
|
|
7458
7476
|
var ControlStateSchema = Type.Union([
|
|
7459
7477
|
Type.Literal("HUMAN_ACTIVE"),
|
|
7460
7478
|
Type.Literal("RESUME_REVIEW"),
|
|
@@ -7463,8 +7481,8 @@ var ControlStateSchema = Type.Union([
|
|
|
7463
7481
|
Type.Literal("STOPPED")
|
|
7464
7482
|
]);
|
|
7465
7483
|
var OperationRecordSchema = Type.Object({
|
|
7466
|
-
operationId:
|
|
7467
|
-
epoch: Type.Integer(),
|
|
7484
|
+
operationId: OperationIdSchema,
|
|
7485
|
+
epoch: Type.Integer({ minimum: 0 }),
|
|
7468
7486
|
status: Type.Union([
|
|
7469
7487
|
Type.Literal("in_flight"),
|
|
7470
7488
|
Type.Literal("completed"),
|
|
@@ -7472,7 +7490,8 @@ var OperationRecordSchema = Type.Object({
|
|
|
7472
7490
|
Type.Literal("outcome_unknown")
|
|
7473
7491
|
]),
|
|
7474
7492
|
dispatched: Type.Boolean()
|
|
7475
|
-
});
|
|
7493
|
+
}, strict);
|
|
7494
|
+
var OperationReplaySchema = Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, { ...strict, $id: "urn:agentbrowser:operation-replay:v1" });
|
|
7476
7495
|
var RunCursorSchema = Type.Object({
|
|
7477
7496
|
version: Type.Literal(1),
|
|
7478
7497
|
serviceGeneration: Type.String({ pattern: "^[A-Za-z0-9_-]{22}$" }),
|
|
@@ -7506,21 +7525,51 @@ var ControlGrantSchema = Type.Intersect([
|
|
|
7506
7525
|
Type.Object({ token: Type.String(), mode: AgentModeSchema, cursor: RunCursorSchema })
|
|
7507
7526
|
]);
|
|
7508
7527
|
|
|
7528
|
+
// ../protocol/dist/application.js
|
|
7529
|
+
var strict2 = { additionalProperties: false };
|
|
7530
|
+
var ID_SCHEMA = OperationIdSchema;
|
|
7531
|
+
var ApplicationBindingSchema = Type.Object({ adapter: ID_SCHEMA, resource: ID_SCHEMA }, strict2);
|
|
7532
|
+
var ApplicationOperationDescriptorSchema = Type.Object({
|
|
7533
|
+
name: ID_SCHEMA,
|
|
7534
|
+
mode: Type.Union([Type.Literal("read"), Type.Literal("write")])
|
|
7535
|
+
}, strict2);
|
|
7536
|
+
var ApplicationDiscoverySchema = Type.Object({
|
|
7537
|
+
adapter: Type.String(),
|
|
7538
|
+
resource: Type.String(),
|
|
7539
|
+
operations: Type.Array(ApplicationOperationDescriptorSchema, { maxItems: 256 })
|
|
7540
|
+
}, strict2);
|
|
7541
|
+
var ApplicationExecuteRequestSchema = Type.Object({
|
|
7542
|
+
operation: ID_SCHEMA,
|
|
7543
|
+
input: Type.Unknown(),
|
|
7544
|
+
operationId: Type.Optional(ID_SCHEMA),
|
|
7545
|
+
expectedVersion: Type.Optional(Type.Integer({ minimum: 0 }))
|
|
7546
|
+
}, strict2);
|
|
7547
|
+
var ApplicationOperationResultSchema = Type.Union([
|
|
7548
|
+
Type.Object({
|
|
7549
|
+
status: Type.Union([Type.Literal("read"), Type.Literal("committed")]),
|
|
7550
|
+
value: Type.Unknown()
|
|
7551
|
+
}, strict2),
|
|
7552
|
+
Type.Object({ status: Type.Literal("rejected"), reason: Type.String() }, strict2),
|
|
7553
|
+
Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, strict2)
|
|
7554
|
+
]);
|
|
7555
|
+
var binding = TypeCompiler.Compile(ApplicationBindingSchema);
|
|
7556
|
+
var execute = TypeCompiler.Compile(ApplicationExecuteRequestSchema);
|
|
7557
|
+
|
|
7509
7558
|
// ../protocol/dist/autofill.js
|
|
7510
7559
|
var text = () => Type.String({ minLength: 1, maxLength: 512 });
|
|
7511
|
-
var
|
|
7560
|
+
var strict3 = { additionalProperties: false };
|
|
7512
7561
|
var AutofillMatchSchema = Type.Object({
|
|
7513
7562
|
role: Type.Optional(text()),
|
|
7514
7563
|
label: Type.Optional(text()),
|
|
7515
7564
|
labelRegex: Type.Optional(text()),
|
|
7516
7565
|
dataAutomationId: Type.Optional(text()),
|
|
7517
|
-
block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...
|
|
7518
|
-
}, { ...
|
|
7566
|
+
block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict3, minProperties: 1 }))
|
|
7567
|
+
}, { ...strict3, minProperties: 1 });
|
|
7519
7568
|
var AutofillRequestSchema = Type.Object({
|
|
7520
7569
|
fields: Type.Array(Type.Object({
|
|
7521
7570
|
match: AutofillMatchSchema,
|
|
7522
7571
|
value: Type.Optional(Type.String({ maxLength: 8192 })),
|
|
7523
|
-
option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) },
|
|
7572
|
+
option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict3)),
|
|
7524
7573
|
verify: Type.Optional(Type.Union([Type.Literal("exact"), Type.Literal("none")])),
|
|
7525
7574
|
strategy: Type.Optional(Type.Union([
|
|
7526
7575
|
Type.Literal("native-input"),
|
|
@@ -7528,15 +7577,15 @@ var AutofillRequestSchema = Type.Object({
|
|
|
7528
7577
|
Type.Literal("react-select"),
|
|
7529
7578
|
Type.Literal("chip-multiselect")
|
|
7530
7579
|
]))
|
|
7531
|
-
},
|
|
7580
|
+
}, strict3), { minItems: 1, maxItems: 50 }),
|
|
7532
7581
|
policy: Type.Optional(Type.Object({
|
|
7533
7582
|
onAmbiguous: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip")])),
|
|
7534
7583
|
onVerifyFail: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip"), Type.Literal("retry")])),
|
|
7535
7584
|
maxReobserve: Type.Optional(Type.Integer({ minimum: 0, maximum: 5 })),
|
|
7536
7585
|
settleMs: Type.Optional(Type.Integer({ minimum: 0, maximum: 2e3 })),
|
|
7537
7586
|
timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 24e4 }))
|
|
7538
|
-
},
|
|
7539
|
-
},
|
|
7587
|
+
}, strict3))
|
|
7588
|
+
}, strict3);
|
|
7540
7589
|
var AutofillReceiptSchema = Type.Object({
|
|
7541
7590
|
field: Type.Integer({ minimum: 0, maximum: 49 }),
|
|
7542
7591
|
match: AutofillMatchSchema,
|
|
@@ -7547,8 +7596,8 @@ var AutofillReceiptSchema = Type.Object({
|
|
|
7547
7596
|
verified: Type.Boolean(),
|
|
7548
7597
|
actual: Type.Optional(Type.String({ maxLength: 512 })),
|
|
7549
7598
|
actualTruncated: Type.Optional(Type.Boolean()),
|
|
7550
|
-
error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() },
|
|
7551
|
-
},
|
|
7599
|
+
error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict3))
|
|
7600
|
+
}, strict3);
|
|
7552
7601
|
var AutofillReportSchema = Type.Object({
|
|
7553
7602
|
ok: Type.Boolean(),
|
|
7554
7603
|
receipts: Type.Array(AutofillReceiptSchema, { maxItems: 50 }),
|
|
@@ -7558,9 +7607,9 @@ var AutofillReportSchema = Type.Object({
|
|
|
7558
7607
|
contentType: Type.Optional(Type.String()),
|
|
7559
7608
|
sizeBytes: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
7560
7609
|
warnings: Type.Optional(Type.Array(Type.String()))
|
|
7561
|
-
},
|
|
7610
|
+
}, strict3)),
|
|
7562
7611
|
snapshotError: Type.Optional(Type.String())
|
|
7563
|
-
}, { ...
|
|
7612
|
+
}, { ...strict3, $id: "urn:agentbrowser:autofill-report:v1" });
|
|
7564
7613
|
function labelPattern(pattern) {
|
|
7565
7614
|
const start = pattern.startsWith("^");
|
|
7566
7615
|
const end = pattern.endsWith("$");
|
|
@@ -7666,7 +7715,7 @@ function createPlanReportParser(actions) {
|
|
|
7666
7715
|
}
|
|
7667
7716
|
|
|
7668
7717
|
// ../protocol/dist/outcome.js
|
|
7669
|
-
var
|
|
7718
|
+
var strict4 = { additionalProperties: false };
|
|
7670
7719
|
var identifier = () => Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9][A-Za-z0-9._-]*$" });
|
|
7671
7720
|
var GROUNDING_LAYERS = Object.freeze(["G0", "G1", "G2", "G3", "G4", "G5", "G6"]);
|
|
7672
7721
|
var GroundingLayerSchema = Type.Union([
|
|
@@ -7691,11 +7740,11 @@ var VerificationProjectionSchema = Type.Object({
|
|
|
7691
7740
|
Type.Literal("unknown"),
|
|
7692
7741
|
Type.Literal("not_requested")
|
|
7693
7742
|
]),
|
|
7694
|
-
verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() },
|
|
7743
|
+
verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() }, strict4)),
|
|
7695
7744
|
requiredLayer: GroundingLayerSchema,
|
|
7696
7745
|
achievedLayer: Type.Optional(GroundingLayerSchema),
|
|
7697
7746
|
evidenceRefIds: EvidenceReferenceIdsSchema
|
|
7698
|
-
},
|
|
7747
|
+
}, strict4);
|
|
7699
7748
|
var OutcomeProjectionSchema = Type.Object({
|
|
7700
7749
|
availability: Type.Union([
|
|
7701
7750
|
Type.Literal("available"),
|
|
@@ -7722,7 +7771,24 @@ var OutcomeProjectionSchema = Type.Object({
|
|
|
7722
7771
|
Type.Literal("application"),
|
|
7723
7772
|
Type.Literal("agent_tool")
|
|
7724
7773
|
])
|
|
7725
|
-
},
|
|
7774
|
+
}, strict4);
|
|
7775
|
+
var evidenceCorrelationIdSchema = {
|
|
7776
|
+
...OperationIdSchema,
|
|
7777
|
+
description: "Business receipt operation ID for an opted-in trusted evidence source; distinct from the service operation ID and conveys no authority."
|
|
7778
|
+
};
|
|
7779
|
+
var OutcomeRunRequestSchema = Type.Object({
|
|
7780
|
+
// A UI outcome must exercise the UI seam; an empty plan cannot attest it.
|
|
7781
|
+
actions: Type.Array(PlanStepSchema, { minItems: 1 }),
|
|
7782
|
+
verification: Type.Object({
|
|
7783
|
+
verifier: Type.Object({ id: identifier(), version: identifier() }, strict4),
|
|
7784
|
+
input: Type.Unknown(),
|
|
7785
|
+
evidenceCorrelationId: Type.Optional(evidenceCorrelationIdSchema)
|
|
7786
|
+
}, strict4)
|
|
7787
|
+
}, { ...strict4, $id: "urn:agentbrowser:outcome-run-request:v1" });
|
|
7788
|
+
var OutcomeRunReportSchema = Type.Object({
|
|
7789
|
+
plan: PlanReportSchema,
|
|
7790
|
+
outcome: OutcomeProjectionSchema
|
|
7791
|
+
}, { ...strict4, $id: "urn:agentbrowser:outcome-run-report:v1" });
|
|
7726
7792
|
var TrustedVerifierDescriptorSchema = Type.Object({
|
|
7727
7793
|
id: identifier(),
|
|
7728
7794
|
version: identifier(),
|
|
@@ -7734,12 +7800,14 @@ var TrustedVerifierDescriptorSchema = Type.Object({
|
|
|
7734
7800
|
budget: Type.Object({
|
|
7735
7801
|
maxReads: Type.Integer({ minimum: 1, maximum: 100 }),
|
|
7736
7802
|
timeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
|
|
7803
|
+
pollIntervalMs: Type.Integer({ minimum: 1, maximum: 1e4 }),
|
|
7804
|
+
cleanupTimeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
|
|
7737
7805
|
maxEvidenceRefs: Type.Integer({ minimum: 1, maximum: 32 })
|
|
7738
|
-
},
|
|
7806
|
+
}, strict4),
|
|
7739
7807
|
redaction: Type.Literal("reference_only"),
|
|
7740
7808
|
unsupported: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), { maxItems: 16 }),
|
|
7741
7809
|
cleanup: Type.Union([Type.Literal("not_needed"), Type.Literal("required")])
|
|
7742
|
-
},
|
|
7810
|
+
}, strict4);
|
|
7743
7811
|
|
|
7744
7812
|
// dist/mcp-server.js
|
|
7745
7813
|
var LEGACY_PROTOCOL_VERSION = "2024-11-05";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvailabs/agentbrowser-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP server exposing AgentBrowser as high-level, safe, composable tools (talks to an AgentBrowser service via AGENTBROWSER_BASE_URL)",
|
|
6
6
|
"main": "dist/index.js",
|