@jackwener/browsermcp 0.0.41-embedded.0 → 0.0.42

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 (110) hide show
  1. package/CHANGELOG.md +4 -56
  2. package/README.md +0 -91
  3. package/dist/docs/api-reference.md +1 -1
  4. package/dist/docs/api-use.md +23 -0
  5. package/dist/docs/instructions.md +1 -0
  6. package/dist/src/api/browser.js +1 -1
  7. package/dist/src/api/browser.js.map +1 -1
  8. package/dist/src/api/tab.js +53 -1
  9. package/dist/src/api/tab.js.map +1 -1
  10. package/dist/src/docs/manifest.js +3 -6
  11. package/dist/src/docs/manifest.js.map +1 -1
  12. package/dist/src/mcp/js-evaluator.mjs +18 -3
  13. package/dist/src/mcp/server.js +6 -4
  14. package/dist/src/mcp/server.js.map +1 -1
  15. package/dist/src/protocol.js.map +1 -1
  16. package/dist/src/runtime/runtime.js +109 -1
  17. package/dist/src/runtime/runtime.js.map +1 -1
  18. package/docs/api-reference.md +1 -1
  19. package/docs/api-use.md +23 -0
  20. package/docs/instructions.md +1 -0
  21. package/extension/dist/background.js +1 -1
  22. package/extension/dist/manifest.json +1 -1
  23. package/package.json +2 -11
  24. package/dist/src/api/action-input.d.ts +0 -87
  25. package/dist/src/api/agent.d.ts +0 -10
  26. package/dist/src/api/api.d.ts +0 -54
  27. package/dist/src/api/browser.d.ts +0 -93
  28. package/dist/src/api/commands.d.ts +0 -514
  29. package/dist/src/api/content-wait.d.ts +0 -18
  30. package/dist/src/api/context.d.ts +0 -7
  31. package/dist/src/api/diff.d.ts +0 -8
  32. package/dist/src/api/errors.d.ts +0 -14
  33. package/dist/src/api/network.d.ts +0 -10
  34. package/dist/src/api/observation.d.ts +0 -4
  35. package/dist/src/api/streams.d.ts +0 -13
  36. package/dist/src/api/tab.d.ts +0 -337
  37. package/dist/src/api/webmcp.d.ts +0 -19
  38. package/dist/src/backends/backend.d.ts +0 -14
  39. package/dist/src/backends/browser-helpers.d.ts +0 -17
  40. package/dist/src/backends/extension-page.d.ts +0 -5
  41. package/dist/src/backends/managed-page.d.ts +0 -50
  42. package/dist/src/backends/page-transport.d.ts +0 -10
  43. package/dist/src/backends/page-types.d.ts +0 -82
  44. package/dist/src/docs/embedded.d.ts +0 -2
  45. package/dist/src/docs/embedded.js +0 -40
  46. package/dist/src/docs/embedded.js.map +0 -1
  47. package/dist/src/docs/manifest.d.ts +0 -23
  48. package/dist/src/docs/surface.d.ts +0 -12
  49. package/dist/src/electron/backend.d.ts +0 -50
  50. package/dist/src/electron/backend.js +0 -377
  51. package/dist/src/electron/backend.js.map +0 -1
  52. package/dist/src/electron/chrome.d.ts +0 -24
  53. package/dist/src/electron/chrome.js +0 -133
  54. package/dist/src/electron/chrome.js.map +0 -1
  55. package/dist/src/electron/driver.d.ts +0 -70
  56. package/dist/src/electron/driver.js +0 -316
  57. package/dist/src/electron/driver.js.map +0 -1
  58. package/dist/src/electron/event-buffer.d.ts +0 -16
  59. package/dist/src/electron/event-buffer.js +0 -59
  60. package/dist/src/electron/event-buffer.js.map +0 -1
  61. package/dist/src/electron/page.js +0 -1030
  62. package/dist/src/electron/registry.d.ts +0 -104
  63. package/dist/src/electron/registry.js +0 -316
  64. package/dist/src/electron/registry.js.map +0 -1
  65. package/dist/src/electron/streams.d.ts +0 -16
  66. package/dist/src/electron/streams.js +0 -48
  67. package/dist/src/electron/streams.js.map +0 -1
  68. package/dist/src/embedded/index.d.ts +0 -39
  69. package/dist/src/embedded/index.js +0 -72
  70. package/dist/src/embedded/index.js.map +0 -1
  71. package/dist/src/host/bridge.d.ts +0 -50
  72. package/dist/src/host/doctor.d.ts +0 -34
  73. package/dist/src/host/extension.d.ts +0 -3
  74. package/dist/src/host/host.d.ts +0 -3
  75. package/dist/src/host/ipc.d.ts +0 -14
  76. package/dist/src/host/jsonc-config.d.ts +0 -1
  77. package/dist/src/host/launch.d.ts +0 -11
  78. package/dist/src/host/native-messaging.d.ts +0 -28
  79. package/dist/src/host/opencode.d.ts +0 -6
  80. package/dist/src/host/pi.d.ts +0 -6
  81. package/dist/src/host/registration.d.ts +0 -24
  82. package/dist/src/host/setup.d.ts +0 -7
  83. package/dist/src/host/socket.d.ts +0 -25
  84. package/dist/src/host/state.d.ts +0 -39
  85. package/dist/src/launcher/stdio.d.ts +0 -3
  86. package/dist/src/lib/paths.d.ts +0 -1
  87. package/dist/src/lib/sources.d.ts +0 -5
  88. package/dist/src/main.d.ts +0 -2
  89. package/dist/src/mcp/catalog.d.ts +0 -202
  90. package/dist/src/mcp/js-session.d.ts +0 -64
  91. package/dist/src/mcp/server.d.ts +0 -15
  92. package/dist/src/protocol.d.ts +0 -329
  93. package/dist/src/recon/analyzer.d.ts +0 -43
  94. package/dist/src/recon/discover.d.ts +0 -48
  95. package/dist/src/runtime/runtime.d.ts +0 -148
  96. package/dist/src/shared/api-contract.d.ts +0 -86
  97. package/dist/src/shared/aria-tree.d.ts +0 -2
  98. package/dist/src/shared/closed-shadow.d.ts +0 -10
  99. package/dist/src/shared/element-ref.d.ts +0 -4
  100. package/dist/src/shared/engine.d.ts +0 -62
  101. package/dist/src/shared/inflight.d.ts +0 -14
  102. package/dist/src/shared/injected-source.d.ts +0 -2
  103. package/dist/src/shared/page-contract.d.ts +0 -278
  104. package/dist/src/sites/define.d.ts +0 -28
  105. package/dist/src/sites/drafts.d.ts +0 -39
  106. package/dist/src/sites/executor.d.ts +0 -34
  107. package/dist/src/sites/loader.d.ts +0 -101
  108. package/dist/src/sites/manifest.d.ts +0 -5
  109. package/dist/src/sites/schema.d.ts +0 -11
  110. package/dist/src/version.d.ts +0 -2
@@ -1,87 +0,0 @@
1
- import { z } from 'zod';
2
- import type { Expectation } from '../shared/page-contract.js';
3
- import type { ActAction, Target } from './tab.js';
4
- export interface RawTarget {
5
- ref?: string | number;
6
- selector?: string;
7
- within?: string;
8
- nth?: number;
9
- role?: string;
10
- name?: string;
11
- label?: string;
12
- text?: string;
13
- testid?: string;
14
- x?: number;
15
- y?: number;
16
- frame?: Target['frame'];
17
- }
18
- export interface ActToolInput {
19
- action: ActAction;
20
- target?: RawTarget;
21
- to?: RawTarget;
22
- value?: string;
23
- files?: string[];
24
- direction?: 'up' | 'down' | 'left' | 'right';
25
- amount?: number;
26
- method?: 'cdp' | 'dom';
27
- timeoutMs?: number;
28
- settleMs?: number;
29
- }
30
- export declare const targetShape: z.ZodObject<{
31
- ref: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
32
- selector: z.ZodOptional<z.ZodString>;
33
- within: z.ZodOptional<z.ZodString>;
34
- nth: z.ZodOptional<z.ZodNumber>;
35
- role: z.ZodOptional<z.ZodString>;
36
- name: z.ZodOptional<z.ZodString>;
37
- label: z.ZodOptional<z.ZodString>;
38
- text: z.ZodOptional<z.ZodString>;
39
- testid: z.ZodOptional<z.ZodString>;
40
- x: z.ZodOptional<z.ZodNumber>;
41
- y: z.ZodOptional<z.ZodNumber>;
42
- frame: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
43
- }, z.core.$strict>;
44
- export declare const expectationShape: z.ZodObject<{
45
- target: z.ZodOptional<z.ZodObject<{
46
- ref: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
47
- selector: z.ZodOptional<z.ZodString>;
48
- within: z.ZodOptional<z.ZodString>;
49
- nth: z.ZodOptional<z.ZodNumber>;
50
- role: z.ZodOptional<z.ZodString>;
51
- name: z.ZodOptional<z.ZodString>;
52
- label: z.ZodOptional<z.ZodString>;
53
- text: z.ZodOptional<z.ZodString>;
54
- testid: z.ZodOptional<z.ZodString>;
55
- x: z.ZodOptional<z.ZodNumber>;
56
- y: z.ZodOptional<z.ZodNumber>;
57
- frame: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>]>>;
58
- }, z.core.$strict>>;
59
- text: z.ZodOptional<z.ZodString>;
60
- notText: z.ZodOptional<z.ZodString>;
61
- url: z.ZodOptional<z.ZodString>;
62
- title: z.ZodOptional<z.ZodString>;
63
- visible: z.ZodOptional<z.ZodBoolean>;
64
- value: z.ZodOptional<z.ZodString>;
65
- checked: z.ZodOptional<z.ZodBoolean>;
66
- selected: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
- enabled: z.ZodOptional<z.ZodBoolean>;
68
- }, z.core.$strict>;
69
- type Need = 'required' | 'nonempty' | 'present' | 'optional' | 'forbidden';
70
- export declare const ACTION_RULES: Record<ActAction, {
71
- target: Need;
72
- value: Need;
73
- files: Need;
74
- to: Need;
75
- scroll: boolean;
76
- }>;
77
- /** What the model can copy into the next call. Wire shape is error.details.expected. */
78
- export declare function expectedAct(action: ActAction): Record<string, string>;
79
- export declare function pickTarget(t: RawTarget | undefined, action: ActAction, slot: 'target' | 'to'): Target | undefined;
80
- export declare function checkActInput(input: ActToolInput): {
81
- target?: Target;
82
- to?: Target;
83
- method?: 'cdp' | 'dom';
84
- };
85
- /** Validate the public contract before sending a compiled expectation to the page. */
86
- export declare function checkExpect(what: Expectation): void;
87
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * The object model — the single surface behind both the typed MCP tools and the `js` session.
3
- * agent.browsers → browser.tabs / browser.user / browser.capabilities → tab.observe / tab.act / …
4
- * sites.<site>.<command>(args) · recon.discover(tab) · tools.define · browser.nameSession / browser.tabs.finalize
5
- * Split by object: tab.ts, browser.ts, api.ts (context.ts carries what they share). This file re-exports them.
6
- */
7
- export * from './tab.js';
8
- export * from './browser.js';
9
- export * from './api.js';
10
- export * from './context.js';
@@ -1,54 +0,0 @@
1
- import { type BrowserHelper, type BrowserCommands } from './commands.js';
2
- /**
3
- * The object model's entry: agent.browsers · sites.<site>.<command>() · recon.discover(tab) · tools.define.
4
- * One surface behind both the typed entry tools and the `js` session.
5
- */
6
- import type { Runtime } from '../runtime/runtime.js';
7
- import { discoverEndpoints, type DiscoverResult } from '../recon/discover.js';
8
- import { listDefinedTools, type ToolDefinition } from '../sites/define.js';
9
- import type { DraftExpectation } from '../sites/drafts.js';
10
- import { Tab } from './tab.js';
11
- import { Browser } from './browser.js';
12
- export interface AgentApi {
13
- helper: BrowserHelper;
14
- agent: {
15
- browsers: {
16
- getDefault(): Promise<Browser>;
17
- };
18
- browser: Browser;
19
- documentation: {
20
- get(name: string): Promise<string | null>;
21
- };
22
- };
23
- sites: Record<string, unknown> & {
24
- search(q: string, limit?: number): Promise<unknown>;
25
- list(): Promise<unknown>;
26
- enable(site: string, opts?: {
27
- write?: boolean;
28
- }): Promise<{
29
- site: string;
30
- tools: string[];
31
- }>;
32
- disable(site: string): Promise<boolean>;
33
- run(site: string, name: string, args?: Record<string, unknown>): Promise<unknown>;
34
- };
35
- recon: {
36
- discover(tab: Tab, opts?: Parameters<typeof discoverEndpoints>[1]): Promise<DiscoverResult>;
37
- };
38
- tools: {
39
- define(def: ToolDefinition | (Omit<ToolDefinition, 'func'> & {
40
- func?: string | ((ctx: Record<string, unknown>) => unknown);
41
- })): ReturnType<Runtime['defineTool']>;
42
- try(draftId: string, args: Record<string, unknown>, expect: DraftExpectation): ReturnType<Runtime['tryToolDraft']>;
43
- activate(draftId: string): ReturnType<Runtime['activateToolDraft']>;
44
- discard(draftId: string): Promise<ReturnType<Runtime['discardToolDraft']>>;
45
- list(): Promise<ReturnType<typeof listDefinedTools>>;
46
- remove(site: string, name: string): ReturnType<Runtime['removeTool']>;
47
- };
48
- session: {
49
- id: string;
50
- };
51
- }
52
- export declare function createAgentApi(rt: Runtime, sessionId: string): AgentApi & {
53
- commands: BrowserCommands;
54
- };
@@ -1,93 +0,0 @@
1
- import { type TabDiscoveryOptions, type TabDiscoveryResult } from '../shared/api-contract.js';
2
- import type { StreamOptions, StreamReadOptions, StreamBatch } from '../protocol.js';
3
- import type { CloseUserTabsResult } from '../protocol.js';
4
- import { Tab } from './tab.js';
5
- import type { SessionContext } from './context.js';
6
- export declare class Browser {
7
- readonly id: string;
8
- readonly type: 'extension' | 'electron';
9
- private readonly ctx;
10
- constructor(id: string, type: 'extension' | 'electron', ctx: SessionContext);
11
- toJSON(): {
12
- type: 'Browser';
13
- id: string;
14
- backend: string;
15
- };
16
- private page;
17
- private ext;
18
- /** Chrome APIs through the connected backend. Electron supports an explicit compatibility subset. */
19
- readonly chrome: {
20
- call: (method: string, args?: unknown[]) => Promise<unknown>;
21
- describe: (member: string) => Promise<unknown>;
22
- watch: (event: string, options?: StreamOptions) => Promise<import("./streams.js").EventStream>;
23
- };
24
- /** This extension's own service-worker logs; not logs of other installed extensions. */
25
- readonly logs: {
26
- watch: (options?: StreamOptions) => Promise<import("./streams.js").EventStream>;
27
- read: (options?: StreamReadOptions) => Promise<StreamBatch>;
28
- };
29
- readonly tabs: {
30
- new: (url?: string) => Promise<Tab>;
31
- list: () => Promise<Array<{
32
- id?: string;
33
- tabId: number;
34
- pending?: true;
35
- url?: string;
36
- title?: string;
37
- active: boolean;
38
- selected: boolean;
39
- lifecycle?: "dormant" | "loading" | "ready";
40
- origin: "agent" | "user";
41
- state: "active" | "handoff";
42
- }>>;
43
- get: (tab: string | {
44
- tab?: string;
45
- tabId: number;
46
- }, opts?: {
47
- timeoutMs?: number;
48
- }) => Promise<Tab>;
49
- selected: () => Promise<Tab | undefined>;
50
- finalize: (opts?: {
51
- keep?: Array<{
52
- tab: string | Tab;
53
- status: "deliverable" | "handoff";
54
- }>;
55
- }) => Promise<{
56
- closed: string[];
57
- released: string[];
58
- retained: string[];
59
- failed: Array<{
60
- page: string;
61
- reason: string;
62
- }>;
63
- }>;
64
- };
65
- readonly user: {
66
- /** Unclaimed supported tabs in the visible scope. Query is trimmed, case-insensitive literal substring of URL OR title (no token splitting). Inspect items, matched, totalInScope, excluded and hasMore; continue with nextOffset. Each call takes a fresh snapshot. */
67
- openTabs: (options?: {
68
- query?: string | undefined;
69
- limit?: number | undefined;
70
- offset?: number | undefined;
71
- } | undefined) => Promise<TabDiscoveryResult>;
72
- /** Claim by foreground, id, or unique url/title lookup; expected fields verify the tab's current identity. */
73
- claimTab: (tab: {
74
- tabId?: number;
75
- active?: boolean;
76
- title?: string;
77
- url?: string;
78
- expectedUrl?: string;
79
- expectedTitle?: string;
80
- }) => Promise<Tab>;
81
- /** Close user tabs by Chrome id without claiming or loading their pages. */
82
- closeTabs: (tabIds: number[]) => Promise<CloseUserTabsResult>;
83
- };
84
- nameSession(name: string): Promise<void>;
85
- readonly capabilities: {
86
- list: () => Promise<Array<{
87
- id: string;
88
- description: string;
89
- }>>;
90
- get: (id: string) => Promise<Record<string, unknown>>;
91
- };
92
- documentation(): Promise<string>;
93
- }