@anvailabs/agentbrowser-mcp 1.8.19 → 1.8.20

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.
Files changed (3) hide show
  1. package/dist/bin.js +207 -28
  2. package/dist/index.js +80 -24
  3. 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 FULL_BROWSER_PROFILE = AGENT_CAPABILITIES;
7440
- var AUDIT_PROFILE = AGENT_CAPABILITIES.filter((capability) => capability !== "page.form");
7441
- var APPLICATION_PROFILE = ["session.control"];
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,7 @@ function agentModeAllows(mode, capability) {
7462
7472
  }
7463
7473
 
7464
7474
  // ../protocol/dist/control.js
7475
+ var strict = { additionalProperties: false };
7465
7476
  var ControlStateSchema = Type.Union([
7466
7477
  Type.Literal("HUMAN_ACTIVE"),
7467
7478
  Type.Literal("RESUME_REVIEW"),
@@ -7470,8 +7481,8 @@ var ControlStateSchema = Type.Union([
7470
7481
  Type.Literal("STOPPED")
7471
7482
  ]);
7472
7483
  var OperationRecordSchema = Type.Object({
7473
- operationId: Type.String(),
7474
- epoch: Type.Integer(),
7484
+ operationId: Type.String({ minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9_-]+$" }),
7485
+ epoch: Type.Integer({ minimum: 0 }),
7475
7486
  status: Type.Union([
7476
7487
  Type.Literal("in_flight"),
7477
7488
  Type.Literal("completed"),
@@ -7479,7 +7490,8 @@ var OperationRecordSchema = Type.Object({
7479
7490
  Type.Literal("outcome_unknown")
7480
7491
  ]),
7481
7492
  dispatched: Type.Boolean()
7482
- });
7493
+ }, strict);
7494
+ var OperationReplaySchema = Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, { ...strict, $id: "urn:agentbrowser:operation-replay:v1" });
7483
7495
  var RunCursorSchema = Type.Object({
7484
7496
  version: Type.Literal(1),
7485
7497
  serviceGeneration: Type.String({ pattern: "^[A-Za-z0-9_-]{22}$" }),
@@ -7496,6 +7508,13 @@ var ControlViewSchema = Type.Object({
7496
7508
  operation: Type.Optional(OperationRecordSchema),
7497
7509
  cursor: Type.Optional(RunCursorSchema)
7498
7510
  });
7511
+ function parseOperationReplay(input) {
7512
+ return parseExecutionReport(OperationReplaySchema, input, "operation replay", void 0, {
7513
+ maxDepth: 4,
7514
+ maxNodes: 32,
7515
+ maxBytes: 4096
7516
+ });
7517
+ }
7499
7518
  var ControlReviewSchema = Type.Intersect([
7500
7519
  ControlViewSchema,
7501
7520
  Type.Object({
@@ -7513,21 +7532,51 @@ var ControlGrantSchema = Type.Intersect([
7513
7532
  Type.Object({ token: Type.String(), mode: AgentModeSchema, cursor: RunCursorSchema })
7514
7533
  ]);
7515
7534
 
7535
+ // ../protocol/dist/application.js
7536
+ var strict2 = { additionalProperties: false };
7537
+ var ID_SCHEMA = Type.String({ minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9_-]+$" });
7538
+ var ApplicationBindingSchema = Type.Object({ adapter: ID_SCHEMA, resource: ID_SCHEMA }, strict2);
7539
+ var ApplicationOperationDescriptorSchema = Type.Object({
7540
+ name: ID_SCHEMA,
7541
+ mode: Type.Union([Type.Literal("read"), Type.Literal("write")])
7542
+ }, strict2);
7543
+ var ApplicationDiscoverySchema = Type.Object({
7544
+ adapter: Type.String(),
7545
+ resource: Type.String(),
7546
+ operations: Type.Array(ApplicationOperationDescriptorSchema, { maxItems: 256 })
7547
+ }, strict2);
7548
+ var ApplicationExecuteRequestSchema = Type.Object({
7549
+ operation: ID_SCHEMA,
7550
+ input: Type.Unknown(),
7551
+ operationId: Type.Optional(ID_SCHEMA),
7552
+ expectedVersion: Type.Optional(Type.Integer({ minimum: 0 }))
7553
+ }, strict2);
7554
+ var ApplicationOperationResultSchema = Type.Union([
7555
+ Type.Object({
7556
+ status: Type.Union([Type.Literal("read"), Type.Literal("committed")]),
7557
+ value: Type.Unknown()
7558
+ }, strict2),
7559
+ Type.Object({ status: Type.Literal("rejected"), reason: Type.String() }, strict2),
7560
+ Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, strict2)
7561
+ ]);
7562
+ var binding = TypeCompiler.Compile(ApplicationBindingSchema);
7563
+ var execute = TypeCompiler.Compile(ApplicationExecuteRequestSchema);
7564
+
7516
7565
  // ../protocol/dist/autofill.js
7517
7566
  var text = () => Type.String({ minLength: 1, maxLength: 512 });
7518
- var strict = { additionalProperties: false };
7567
+ var strict3 = { additionalProperties: false };
7519
7568
  var AutofillMatchSchema = Type.Object({
7520
7569
  role: Type.Optional(text()),
7521
7570
  label: Type.Optional(text()),
7522
7571
  labelRegex: Type.Optional(text()),
7523
7572
  dataAutomationId: Type.Optional(text()),
7524
- block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict, minProperties: 1 }))
7525
- }, { ...strict, minProperties: 1 });
7573
+ block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict3, minProperties: 1 }))
7574
+ }, { ...strict3, minProperties: 1 });
7526
7575
  var AutofillRequestSchema = Type.Object({
7527
7576
  fields: Type.Array(Type.Object({
7528
7577
  match: AutofillMatchSchema,
7529
7578
  value: Type.Optional(Type.String({ maxLength: 8192 })),
7530
- option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict)),
7579
+ option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict3)),
7531
7580
  verify: Type.Optional(Type.Union([Type.Literal("exact"), Type.Literal("none")])),
7532
7581
  strategy: Type.Optional(Type.Union([
7533
7582
  Type.Literal("native-input"),
@@ -7535,15 +7584,15 @@ var AutofillRequestSchema = Type.Object({
7535
7584
  Type.Literal("react-select"),
7536
7585
  Type.Literal("chip-multiselect")
7537
7586
  ]))
7538
- }, strict), { minItems: 1, maxItems: 50 }),
7587
+ }, strict3), { minItems: 1, maxItems: 50 }),
7539
7588
  policy: Type.Optional(Type.Object({
7540
7589
  onAmbiguous: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip")])),
7541
7590
  onVerifyFail: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip"), Type.Literal("retry")])),
7542
7591
  maxReobserve: Type.Optional(Type.Integer({ minimum: 0, maximum: 5 })),
7543
7592
  settleMs: Type.Optional(Type.Integer({ minimum: 0, maximum: 2e3 })),
7544
7593
  timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 24e4 }))
7545
- }, strict))
7546
- }, strict);
7594
+ }, strict3))
7595
+ }, strict3);
7547
7596
  var AutofillReceiptSchema = Type.Object({
7548
7597
  field: Type.Integer({ minimum: 0, maximum: 49 }),
7549
7598
  match: AutofillMatchSchema,
@@ -7554,8 +7603,8 @@ var AutofillReceiptSchema = Type.Object({
7554
7603
  verified: Type.Boolean(),
7555
7604
  actual: Type.Optional(Type.String({ maxLength: 512 })),
7556
7605
  actualTruncated: Type.Optional(Type.Boolean()),
7557
- error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict))
7558
- }, strict);
7606
+ error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict3))
7607
+ }, strict3);
7559
7608
  var AutofillReportSchema = Type.Object({
7560
7609
  ok: Type.Boolean(),
7561
7610
  receipts: Type.Array(AutofillReceiptSchema, { maxItems: 50 }),
@@ -7565,9 +7614,9 @@ var AutofillReportSchema = Type.Object({
7565
7614
  contentType: Type.Optional(Type.String()),
7566
7615
  sizeBytes: Type.Optional(Type.Integer({ minimum: 0 })),
7567
7616
  warnings: Type.Optional(Type.Array(Type.String()))
7568
- }, strict)),
7617
+ }, strict3)),
7569
7618
  snapshotError: Type.Optional(Type.String())
7570
- }, { ...strict, $id: "urn:agentbrowser:autofill-report:v1" });
7619
+ }, { ...strict3, $id: "urn:agentbrowser:autofill-report:v1" });
7571
7620
  function labelPattern(pattern) {
7572
7621
  const start = pattern.startsWith("^");
7573
7622
  const end = pattern.endsWith("$");
@@ -7673,7 +7722,7 @@ function createPlanReportParser(actions) {
7673
7722
  }
7674
7723
 
7675
7724
  // ../protocol/dist/outcome.js
7676
- var strict2 = { additionalProperties: false };
7725
+ var strict4 = { additionalProperties: false };
7677
7726
  var identifier = () => Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9][A-Za-z0-9._-]*$" });
7678
7727
  var GROUNDING_LAYERS = Object.freeze(["G0", "G1", "G2", "G3", "G4", "G5", "G6"]);
7679
7728
  var GroundingLayerSchema = Type.Union([
@@ -7698,11 +7747,11 @@ var VerificationProjectionSchema = Type.Object({
7698
7747
  Type.Literal("unknown"),
7699
7748
  Type.Literal("not_requested")
7700
7749
  ]),
7701
- verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() }, strict2)),
7750
+ verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() }, strict4)),
7702
7751
  requiredLayer: GroundingLayerSchema,
7703
7752
  achievedLayer: Type.Optional(GroundingLayerSchema),
7704
7753
  evidenceRefIds: EvidenceReferenceIdsSchema
7705
- }, strict2);
7754
+ }, strict4);
7706
7755
  var OutcomeProjectionSchema = Type.Object({
7707
7756
  availability: Type.Union([
7708
7757
  Type.Literal("available"),
@@ -7729,7 +7778,19 @@ var OutcomeProjectionSchema = Type.Object({
7729
7778
  Type.Literal("application"),
7730
7779
  Type.Literal("agent_tool")
7731
7780
  ])
7732
- }, strict2);
7781
+ }, strict4);
7782
+ var OutcomeRunRequestSchema = Type.Object({
7783
+ // A UI outcome must exercise the UI seam; an empty plan cannot attest it.
7784
+ actions: Type.Array(PlanStepSchema, { minItems: 1 }),
7785
+ verification: Type.Object({
7786
+ verifier: Type.Object({ id: identifier(), version: identifier() }, strict4),
7787
+ input: Type.Unknown()
7788
+ }, strict4)
7789
+ }, { ...strict4, $id: "urn:agentbrowser:outcome-run-request:v1" });
7790
+ var OutcomeRunReportSchema = Type.Object({
7791
+ plan: PlanReportSchema,
7792
+ outcome: OutcomeProjectionSchema
7793
+ }, { ...strict4, $id: "urn:agentbrowser:outcome-run-report:v1" });
7733
7794
  var TrustedVerifierDescriptorSchema = Type.Object({
7734
7795
  id: identifier(),
7735
7796
  version: identifier(),
@@ -7741,12 +7802,68 @@ var TrustedVerifierDescriptorSchema = Type.Object({
7741
7802
  budget: Type.Object({
7742
7803
  maxReads: Type.Integer({ minimum: 1, maximum: 100 }),
7743
7804
  timeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
7805
+ pollIntervalMs: Type.Integer({ minimum: 1, maximum: 1e4 }),
7806
+ cleanupTimeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
7744
7807
  maxEvidenceRefs: Type.Integer({ minimum: 1, maximum: 32 })
7745
- }, strict2),
7808
+ }, strict4),
7746
7809
  redaction: Type.Literal("reference_only"),
7747
7810
  unsupported: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), { maxItems: 16 }),
7748
7811
  cleanup: Type.Union([Type.Literal("not_needed"), Type.Literal("required")])
7749
- }, strict2);
7812
+ }, strict4);
7813
+ var layer = (value) => GROUNDING_LAYERS.indexOf(value);
7814
+ function validVerification(value) {
7815
+ if (value.status === "not_requested")
7816
+ return value.verifier === void 0 && value.achievedLayer === void 0 && value.evidenceRefIds.length === 0;
7817
+ if (!value.verifier)
7818
+ return false;
7819
+ if (value.status === "unknown")
7820
+ return true;
7821
+ if (value.achievedLayer === void 0 || value.evidenceRefIds.length === 0)
7822
+ return false;
7823
+ return value.status !== "passed" || layer(value.achievedLayer) >= layer(value.requiredLayer);
7824
+ }
7825
+ function parseOutcomeProjection(input) {
7826
+ return parseExecutionReport(OutcomeProjectionSchema, input, "outcome projection", (outcome) => validVerification(outcome.verification), VERIFICATION_SNAPSHOT_LIMITS);
7827
+ }
7828
+ function parseOutcomeRunRequest(input) {
7829
+ return parseExecutionReport(OutcomeRunRequestSchema, input, "outcome run request", void 0, VERIFICATION_SNAPSHOT_LIMITS);
7830
+ }
7831
+ function validRunAxes(plan, outcome) {
7832
+ if (plan.ok !== (outcome.execution === "completed"))
7833
+ return false;
7834
+ if (!plan.ok && outcome.execution !== "failed" && outcome.execution !== "unknown") {
7835
+ const unavailableBeforeExecution = outcome.execution === "not_started" && outcome.availability !== "available" && plan.completed === 0 && plan.results.length === 0;
7836
+ if (!unavailableBeforeExecution)
7837
+ return false;
7838
+ }
7839
+ return outcome.verification.status !== "passed" || outcome.execution === "completed";
7840
+ }
7841
+ function invalidOutcomeRunReport() {
7842
+ throw new Error(`Invalid outcome run report. ${INTERACTION_GUIDANCE.uncertainWrite}`);
7843
+ }
7844
+ function parseRunReport(input, parsePlan, verifier) {
7845
+ const report = parseExecutionReport(OutcomeRunReportSchema, input, "outcome run report", void 0, VERIFICATION_SNAPSHOT_LIMITS);
7846
+ let plan;
7847
+ let outcome;
7848
+ try {
7849
+ plan = parsePlan(report.plan);
7850
+ outcome = parseOutcomeProjection(report.outcome);
7851
+ } catch {
7852
+ return invalidOutcomeRunReport();
7853
+ }
7854
+ if (!validRunAxes(plan, outcome))
7855
+ return invalidOutcomeRunReport();
7856
+ if (verifier !== void 0 && (outcome.verification.verifier?.id !== verifier.id || outcome.verification.verifier.version !== verifier.version)) {
7857
+ return invalidOutcomeRunReport();
7858
+ }
7859
+ return { plan, outcome };
7860
+ }
7861
+ function createOutcomeRunReportParser(request) {
7862
+ const snapshot = parseOutcomeRunRequest(request);
7863
+ const parsePlan = createPlanReportParser(snapshot.actions);
7864
+ const verifier = Object.freeze({ ...snapshot.verification.verifier });
7865
+ return (input) => parseRunReport(input, parsePlan, verifier);
7866
+ }
7750
7867
 
7751
7868
  // ../sdk-typescript/dist/client.js
7752
7869
  var AgentBrowserError = class extends Error {
@@ -7775,7 +7892,13 @@ var HttpClient = class {
7775
7892
  this.headers = headers;
7776
7893
  }
7777
7894
  async requestJson(path, init = {}) {
7778
- const operationId = path.startsWith("/v1/sessions/") && !path.includes("/control") && init.method && init.method !== "GET" ? init.operationId ?? this.headers["x-agentbrowser-operation-id"] ?? crypto.randomUUID() : void 0;
7895
+ const operationId = path.startsWith("/v1/sessions/") && !path.includes("/control") && // Application routes carry their operation identity in the BODY
7896
+ // (deduplicated and fingerprinted by the ApplicationAuthority); the
7897
+ // server ignores the header there. Deriving one here would mint a
7898
+ // random UUID, poison error details with a phantom ID, and make the
7899
+ // replay guard reject legitimate application replays whose recorded
7900
+ // operation ID can never equal a locally minted UUID.
7901
+ !path.includes("/application") && init.method && init.method !== "GET" ? init.operationId ?? this.headers["x-agentbrowser-operation-id"] ?? crypto.randomUUID() : void 0;
7779
7902
  const controller = new AbortController();
7780
7903
  const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs ?? this.timeoutMs);
7781
7904
  try {
@@ -7810,13 +7933,24 @@ var HttpClient = class {
7810
7933
  throw new AgentBrowserError(error2.code, error2.message, error2.retryable, { ...error2.details, ...operationId ? { operationId } : {} }, error2.action, error2.traceId);
7811
7934
  }
7812
7935
  const result = await response.json();
7813
- if (result?.replay === true)
7814
- throw new AgentBrowserError("OPERATION_RECORDED", "Operation already recorded; reconcile its status before taking further action", false, { operationId, operation: result.operation });
7936
+ const invalidResponse = () => new AgentBrowserError("INVALID_RESPONSE", `Invalid operation response. ${INTERACTION_GUIDANCE.uncertainWrite}`, false, operationId ? { operationId } : void 0);
7937
+ const replayShaped = typeof result === "object" && result !== null && !Array.isArray(result) && Object.hasOwn(result, "replay") && result.replay === true;
7938
+ if (operationId && replayShaped) {
7939
+ let replay;
7940
+ try {
7941
+ replay = parseOperationReplay(result);
7942
+ } catch {
7943
+ throw invalidResponse();
7944
+ }
7945
+ if (replay.operation.operationId !== operationId)
7946
+ throw invalidResponse();
7947
+ throw new AgentBrowserError("OPERATION_RECORDED", "Operation already recorded; reconcile its status before taking further action", false, { operationId, operation: replay.operation });
7948
+ }
7815
7949
  if (init.parseResponse) {
7816
7950
  try {
7817
7951
  return init.parseResponse(result);
7818
7952
  } catch {
7819
- throw new AgentBrowserError("INVALID_RESPONSE", `Invalid operation response. ${INTERACTION_GUIDANCE.uncertainWrite}`, false, operationId ? { operationId } : void 0);
7953
+ throw invalidResponse();
7820
7954
  }
7821
7955
  }
7822
7956
  return result;
@@ -7857,6 +7991,41 @@ var SessionsClient = class {
7857
7991
  async operation(sessionId, operationId) {
7858
7992
  return this.http.requestJson(`/v1/sessions/${sessionId}/operations/${encodeURIComponent(operationId)}`);
7859
7993
  }
7994
+ /** Operator: bind an application adapter to a resource while the human owns the session. */
7995
+ async applicationBind(sessionId, binding2) {
7996
+ return this.http.requestJson(`/v1/sessions/${sessionId}/application`, {
7997
+ method: "PUT",
7998
+ body: binding2
7999
+ });
8000
+ }
8001
+ /**
8002
+ * Operator: drop the binding. Like bind, this requires the human to own
8003
+ * the session - it takes control as a side effect (bumping the control
8004
+ * epoch and invalidating a prepared review) even when nothing is bound.
8005
+ */
8006
+ async applicationUnbind(sessionId) {
8007
+ return this.http.requestJson(`/v1/sessions/${sessionId}/application`, { method: "DELETE" });
8008
+ }
8009
+ /** The bound adapter's operations, or null when nothing is bound. */
8010
+ async applicationDiscover(sessionId) {
8011
+ return this.http.requestJson(`/v1/sessions/${sessionId}/application`);
8012
+ }
8013
+ /**
8014
+ * Dispatch one application operation. Writes need operationId +
8015
+ * expectedVersion; a repeated operationId returns the recorded
8016
+ * operation (`replay: true`) instead of re-executing - the retry-safe
8017
+ * path. Read operations must not carry either identity.
8018
+ */
8019
+ async applicationExecute(sessionId, request) {
8020
+ return this.http.requestJson(`/v1/sessions/${sessionId}/application/execute`, {
8021
+ method: "POST",
8022
+ body: request
8023
+ });
8024
+ }
8025
+ /** Read one application receipt by operation ID; null when the adapter has none. */
8026
+ async applicationReceipt(sessionId, operationId) {
8027
+ return this.http.requestJson(`/v1/sessions/${sessionId}/application/receipts/${encodeURIComponent(operationId)}`);
8028
+ }
7860
8029
  async listPages(sessionId) {
7861
8030
  const result = await this.http.requestJson(`/v1/sessions/${sessionId}/pages`);
7862
8031
  return result.pages;
@@ -7946,6 +8115,16 @@ var SessionsClient = class {
7946
8115
  parseResponse
7947
8116
  });
7948
8117
  }
8118
+ /** Execute one existing plan and verify its outcome through a trusted server source. */
8119
+ async outcome(sessionId, pageId, request, options = {}) {
8120
+ const parseResponse = createOutcomeRunReportParser(request);
8121
+ return this.http.requestJson(`/v1/sessions/${sessionId}/pages/${pageId}/outcomes`, {
8122
+ method: "POST",
8123
+ body: request,
8124
+ ...options,
8125
+ parseResponse
8126
+ });
8127
+ }
7949
8128
  /** TD-BROWSER-8: self-contained snapshot payload for one-shot LLM reasoning. */
7950
8129
  async snapshot(sessionId, pageId, bounds) {
7951
8130
  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 FULL_BROWSER_PROFILE = AGENT_CAPABILITIES;
7436
- var AUDIT_PROFILE = AGENT_CAPABILITIES.filter((capability) => capability !== "page.form");
7437
- var APPLICATION_PROFILE = ["session.control"];
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,7 @@ function agentModeAllows(mode, capability) {
7455
7465
  }
7456
7466
 
7457
7467
  // ../protocol/dist/control.js
7468
+ var strict = { additionalProperties: false };
7458
7469
  var ControlStateSchema = Type.Union([
7459
7470
  Type.Literal("HUMAN_ACTIVE"),
7460
7471
  Type.Literal("RESUME_REVIEW"),
@@ -7463,8 +7474,8 @@ var ControlStateSchema = Type.Union([
7463
7474
  Type.Literal("STOPPED")
7464
7475
  ]);
7465
7476
  var OperationRecordSchema = Type.Object({
7466
- operationId: Type.String(),
7467
- epoch: Type.Integer(),
7477
+ operationId: Type.String({ minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9_-]+$" }),
7478
+ epoch: Type.Integer({ minimum: 0 }),
7468
7479
  status: Type.Union([
7469
7480
  Type.Literal("in_flight"),
7470
7481
  Type.Literal("completed"),
@@ -7472,7 +7483,8 @@ var OperationRecordSchema = Type.Object({
7472
7483
  Type.Literal("outcome_unknown")
7473
7484
  ]),
7474
7485
  dispatched: Type.Boolean()
7475
- });
7486
+ }, strict);
7487
+ var OperationReplaySchema = Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, { ...strict, $id: "urn:agentbrowser:operation-replay:v1" });
7476
7488
  var RunCursorSchema = Type.Object({
7477
7489
  version: Type.Literal(1),
7478
7490
  serviceGeneration: Type.String({ pattern: "^[A-Za-z0-9_-]{22}$" }),
@@ -7506,21 +7518,51 @@ var ControlGrantSchema = Type.Intersect([
7506
7518
  Type.Object({ token: Type.String(), mode: AgentModeSchema, cursor: RunCursorSchema })
7507
7519
  ]);
7508
7520
 
7521
+ // ../protocol/dist/application.js
7522
+ var strict2 = { additionalProperties: false };
7523
+ var ID_SCHEMA = Type.String({ minLength: 1, maxLength: 128, pattern: "^[a-zA-Z0-9_-]+$" });
7524
+ var ApplicationBindingSchema = Type.Object({ adapter: ID_SCHEMA, resource: ID_SCHEMA }, strict2);
7525
+ var ApplicationOperationDescriptorSchema = Type.Object({
7526
+ name: ID_SCHEMA,
7527
+ mode: Type.Union([Type.Literal("read"), Type.Literal("write")])
7528
+ }, strict2);
7529
+ var ApplicationDiscoverySchema = Type.Object({
7530
+ adapter: Type.String(),
7531
+ resource: Type.String(),
7532
+ operations: Type.Array(ApplicationOperationDescriptorSchema, { maxItems: 256 })
7533
+ }, strict2);
7534
+ var ApplicationExecuteRequestSchema = Type.Object({
7535
+ operation: ID_SCHEMA,
7536
+ input: Type.Unknown(),
7537
+ operationId: Type.Optional(ID_SCHEMA),
7538
+ expectedVersion: Type.Optional(Type.Integer({ minimum: 0 }))
7539
+ }, strict2);
7540
+ var ApplicationOperationResultSchema = Type.Union([
7541
+ Type.Object({
7542
+ status: Type.Union([Type.Literal("read"), Type.Literal("committed")]),
7543
+ value: Type.Unknown()
7544
+ }, strict2),
7545
+ Type.Object({ status: Type.Literal("rejected"), reason: Type.String() }, strict2),
7546
+ Type.Object({ replay: Type.Literal(true), operation: OperationRecordSchema }, strict2)
7547
+ ]);
7548
+ var binding = TypeCompiler.Compile(ApplicationBindingSchema);
7549
+ var execute = TypeCompiler.Compile(ApplicationExecuteRequestSchema);
7550
+
7509
7551
  // ../protocol/dist/autofill.js
7510
7552
  var text = () => Type.String({ minLength: 1, maxLength: 512 });
7511
- var strict = { additionalProperties: false };
7553
+ var strict3 = { additionalProperties: false };
7512
7554
  var AutofillMatchSchema = Type.Object({
7513
7555
  role: Type.Optional(text()),
7514
7556
  label: Type.Optional(text()),
7515
7557
  labelRegex: Type.Optional(text()),
7516
7558
  dataAutomationId: Type.Optional(text()),
7517
- block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict, minProperties: 1 }))
7518
- }, { ...strict, minProperties: 1 });
7559
+ block: Type.Optional(Type.Object({ id: Type.Optional(text()), label: Type.Optional(text()) }, { ...strict3, minProperties: 1 }))
7560
+ }, { ...strict3, minProperties: 1 });
7519
7561
  var AutofillRequestSchema = Type.Object({
7520
7562
  fields: Type.Array(Type.Object({
7521
7563
  match: AutofillMatchSchema,
7522
7564
  value: Type.Optional(Type.String({ maxLength: 8192 })),
7523
- option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict)),
7565
+ option: Type.Optional(Type.Object({ value: Type.String({ maxLength: 8192 }) }, strict3)),
7524
7566
  verify: Type.Optional(Type.Union([Type.Literal("exact"), Type.Literal("none")])),
7525
7567
  strategy: Type.Optional(Type.Union([
7526
7568
  Type.Literal("native-input"),
@@ -7528,15 +7570,15 @@ var AutofillRequestSchema = Type.Object({
7528
7570
  Type.Literal("react-select"),
7529
7571
  Type.Literal("chip-multiselect")
7530
7572
  ]))
7531
- }, strict), { minItems: 1, maxItems: 50 }),
7573
+ }, strict3), { minItems: 1, maxItems: 50 }),
7532
7574
  policy: Type.Optional(Type.Object({
7533
7575
  onAmbiguous: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip")])),
7534
7576
  onVerifyFail: Type.Optional(Type.Union([Type.Literal("fail"), Type.Literal("skip"), Type.Literal("retry")])),
7535
7577
  maxReobserve: Type.Optional(Type.Integer({ minimum: 0, maximum: 5 })),
7536
7578
  settleMs: Type.Optional(Type.Integer({ minimum: 0, maximum: 2e3 })),
7537
7579
  timeoutMs: Type.Optional(Type.Integer({ minimum: 1, maximum: 24e4 }))
7538
- }, strict))
7539
- }, strict);
7580
+ }, strict3))
7581
+ }, strict3);
7540
7582
  var AutofillReceiptSchema = Type.Object({
7541
7583
  field: Type.Integer({ minimum: 0, maximum: 49 }),
7542
7584
  match: AutofillMatchSchema,
@@ -7547,8 +7589,8 @@ var AutofillReceiptSchema = Type.Object({
7547
7589
  verified: Type.Boolean(),
7548
7590
  actual: Type.Optional(Type.String({ maxLength: 512 })),
7549
7591
  actualTruncated: Type.Optional(Type.Boolean()),
7550
- error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict))
7551
- }, strict);
7592
+ error: Type.Optional(Type.Object({ code: Type.String(), message: Type.String() }, strict3))
7593
+ }, strict3);
7552
7594
  var AutofillReportSchema = Type.Object({
7553
7595
  ok: Type.Boolean(),
7554
7596
  receipts: Type.Array(AutofillReceiptSchema, { maxItems: 50 }),
@@ -7558,9 +7600,9 @@ var AutofillReportSchema = Type.Object({
7558
7600
  contentType: Type.Optional(Type.String()),
7559
7601
  sizeBytes: Type.Optional(Type.Integer({ minimum: 0 })),
7560
7602
  warnings: Type.Optional(Type.Array(Type.String()))
7561
- }, strict)),
7603
+ }, strict3)),
7562
7604
  snapshotError: Type.Optional(Type.String())
7563
- }, { ...strict, $id: "urn:agentbrowser:autofill-report:v1" });
7605
+ }, { ...strict3, $id: "urn:agentbrowser:autofill-report:v1" });
7564
7606
  function labelPattern(pattern) {
7565
7607
  const start = pattern.startsWith("^");
7566
7608
  const end = pattern.endsWith("$");
@@ -7666,7 +7708,7 @@ function createPlanReportParser(actions) {
7666
7708
  }
7667
7709
 
7668
7710
  // ../protocol/dist/outcome.js
7669
- var strict2 = { additionalProperties: false };
7711
+ var strict4 = { additionalProperties: false };
7670
7712
  var identifier = () => Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9][A-Za-z0-9._-]*$" });
7671
7713
  var GROUNDING_LAYERS = Object.freeze(["G0", "G1", "G2", "G3", "G4", "G5", "G6"]);
7672
7714
  var GroundingLayerSchema = Type.Union([
@@ -7691,11 +7733,11 @@ var VerificationProjectionSchema = Type.Object({
7691
7733
  Type.Literal("unknown"),
7692
7734
  Type.Literal("not_requested")
7693
7735
  ]),
7694
- verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() }, strict2)),
7736
+ verifier: Type.Optional(Type.Object({ id: identifier(), version: identifier() }, strict4)),
7695
7737
  requiredLayer: GroundingLayerSchema,
7696
7738
  achievedLayer: Type.Optional(GroundingLayerSchema),
7697
7739
  evidenceRefIds: EvidenceReferenceIdsSchema
7698
- }, strict2);
7740
+ }, strict4);
7699
7741
  var OutcomeProjectionSchema = Type.Object({
7700
7742
  availability: Type.Union([
7701
7743
  Type.Literal("available"),
@@ -7722,7 +7764,19 @@ var OutcomeProjectionSchema = Type.Object({
7722
7764
  Type.Literal("application"),
7723
7765
  Type.Literal("agent_tool")
7724
7766
  ])
7725
- }, strict2);
7767
+ }, strict4);
7768
+ var OutcomeRunRequestSchema = Type.Object({
7769
+ // A UI outcome must exercise the UI seam; an empty plan cannot attest it.
7770
+ actions: Type.Array(PlanStepSchema, { minItems: 1 }),
7771
+ verification: Type.Object({
7772
+ verifier: Type.Object({ id: identifier(), version: identifier() }, strict4),
7773
+ input: Type.Unknown()
7774
+ }, strict4)
7775
+ }, { ...strict4, $id: "urn:agentbrowser:outcome-run-request:v1" });
7776
+ var OutcomeRunReportSchema = Type.Object({
7777
+ plan: PlanReportSchema,
7778
+ outcome: OutcomeProjectionSchema
7779
+ }, { ...strict4, $id: "urn:agentbrowser:outcome-run-report:v1" });
7726
7780
  var TrustedVerifierDescriptorSchema = Type.Object({
7727
7781
  id: identifier(),
7728
7782
  version: identifier(),
@@ -7734,12 +7788,14 @@ var TrustedVerifierDescriptorSchema = Type.Object({
7734
7788
  budget: Type.Object({
7735
7789
  maxReads: Type.Integer({ minimum: 1, maximum: 100 }),
7736
7790
  timeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
7791
+ pollIntervalMs: Type.Integer({ minimum: 1, maximum: 1e4 }),
7792
+ cleanupTimeoutMs: Type.Integer({ minimum: 1, maximum: 6e4 }),
7737
7793
  maxEvidenceRefs: Type.Integer({ minimum: 1, maximum: 32 })
7738
- }, strict2),
7794
+ }, strict4),
7739
7795
  redaction: Type.Literal("reference_only"),
7740
7796
  unsupported: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), { maxItems: 16 }),
7741
7797
  cleanup: Type.Union([Type.Literal("not_needed"), Type.Literal("required")])
7742
- }, strict2);
7798
+ }, strict4);
7743
7799
 
7744
7800
  // dist/mcp-server.js
7745
7801
  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.8.19",
3
+ "version": "1.8.20",
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",