@jackwener/browsermcp 0.0.36 → 0.0.37-embedded.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +91 -0
  3. package/dist/src/api/action-input.d.ts +62 -0
  4. package/dist/src/api/agent.d.ts +10 -0
  5. package/dist/src/api/api.d.ts +54 -0
  6. package/dist/src/api/browser.d.ts +93 -0
  7. package/dist/src/api/commands.d.ts +452 -0
  8. package/dist/src/api/context.d.ts +7 -0
  9. package/dist/src/api/diff.d.ts +8 -0
  10. package/dist/src/api/errors.d.ts +12 -0
  11. package/dist/src/api/network.d.ts +10 -0
  12. package/dist/src/api/observation.d.ts +4 -0
  13. package/dist/src/api/streams.d.ts +13 -0
  14. package/dist/src/api/tab.d.ts +312 -0
  15. package/dist/src/api/webmcp.d.ts +19 -0
  16. package/dist/src/backends/backend.d.ts +14 -0
  17. package/dist/src/backends/browser-helpers.d.ts +17 -0
  18. package/dist/src/backends/extension-page.d.ts +5 -0
  19. package/dist/src/backends/managed-page.d.ts +50 -0
  20. package/dist/src/backends/page-transport.d.ts +10 -0
  21. package/dist/src/backends/page-types.d.ts +82 -0
  22. package/dist/src/docs/embedded.d.ts +2 -0
  23. package/dist/src/docs/embedded.js +40 -0
  24. package/dist/src/docs/embedded.js.map +1 -0
  25. package/dist/src/docs/manifest.d.ts +23 -0
  26. package/dist/src/docs/manifest.js +6 -3
  27. package/dist/src/docs/manifest.js.map +1 -1
  28. package/dist/src/docs/surface.d.ts +12 -0
  29. package/dist/src/electron/backend.d.ts +50 -0
  30. package/dist/src/electron/backend.js +375 -0
  31. package/dist/src/electron/backend.js.map +1 -0
  32. package/dist/src/electron/chrome.d.ts +24 -0
  33. package/dist/src/electron/chrome.js +133 -0
  34. package/dist/src/electron/chrome.js.map +1 -0
  35. package/dist/src/electron/driver.d.ts +43 -0
  36. package/dist/src/electron/driver.js +241 -0
  37. package/dist/src/electron/driver.js.map +1 -0
  38. package/dist/src/electron/event-buffer.d.ts +16 -0
  39. package/dist/src/electron/event-buffer.js +59 -0
  40. package/dist/src/electron/event-buffer.js.map +1 -0
  41. package/dist/src/electron/page.js +834 -0
  42. package/dist/src/electron/registry.d.ts +104 -0
  43. package/dist/src/electron/registry.js +316 -0
  44. package/dist/src/electron/registry.js.map +1 -0
  45. package/dist/src/electron/streams.d.ts +16 -0
  46. package/dist/src/electron/streams.js +48 -0
  47. package/dist/src/electron/streams.js.map +1 -0
  48. package/dist/src/embedded/index.d.ts +39 -0
  49. package/dist/src/embedded/index.js +72 -0
  50. package/dist/src/embedded/index.js.map +1 -0
  51. package/dist/src/host/bridge.d.ts +50 -0
  52. package/dist/src/host/doctor.d.ts +34 -0
  53. package/dist/src/host/extension.d.ts +3 -0
  54. package/dist/src/host/host.d.ts +3 -0
  55. package/dist/src/host/ipc.d.ts +14 -0
  56. package/dist/src/host/jsonc-config.d.ts +1 -0
  57. package/dist/src/host/launch.d.ts +11 -0
  58. package/dist/src/host/native-messaging.d.ts +28 -0
  59. package/dist/src/host/opencode.d.ts +6 -0
  60. package/dist/src/host/pi.d.ts +6 -0
  61. package/dist/src/host/registration.d.ts +24 -0
  62. package/dist/src/host/setup.d.ts +7 -0
  63. package/dist/src/host/socket.d.ts +25 -0
  64. package/dist/src/host/state.d.ts +39 -0
  65. package/dist/src/launcher/stdio.d.ts +3 -0
  66. package/dist/src/lib/paths.d.ts +1 -0
  67. package/dist/src/lib/sources.d.ts +5 -0
  68. package/dist/src/main.d.ts +2 -0
  69. package/dist/src/mcp/catalog.d.ts +202 -0
  70. package/dist/src/mcp/js-session.d.ts +64 -0
  71. package/dist/src/mcp/server.d.ts +15 -0
  72. package/dist/src/protocol.d.ts +320 -0
  73. package/dist/src/recon/analyzer.d.ts +43 -0
  74. package/dist/src/recon/discover.d.ts +48 -0
  75. package/dist/src/runtime/runtime.d.ts +148 -0
  76. package/dist/src/shared/api-contract.d.ts +86 -0
  77. package/dist/src/shared/aria-tree.d.ts +2 -0
  78. package/dist/src/shared/element-ref.d.ts +4 -0
  79. package/dist/src/shared/engine.d.ts +50 -0
  80. package/dist/src/shared/injected-source.d.ts +2 -0
  81. package/dist/src/shared/page-contract.d.ts +256 -0
  82. package/dist/src/sites/define.d.ts +28 -0
  83. package/dist/src/sites/drafts.d.ts +39 -0
  84. package/dist/src/sites/executor.d.ts +34 -0
  85. package/dist/src/sites/loader.d.ts +84 -0
  86. package/dist/src/sites/schema.d.ts +11 -0
  87. package/dist/src/version.d.ts +2 -0
  88. package/package.json +12 -3
@@ -0,0 +1,50 @@
1
+ import type { ActSpec, ActResult, ActTarget, FrameStep } from '../protocol.js';
2
+ export { ENGINE_GLOBAL, PAGE_GLOBAL } from './page-contract.js';
3
+ /** Evaluate once per world: installs Playwright's InjectedScript as globalThis.__browsermcpInjected, then the page module. */
4
+ export declare function installEngineJs(injectedSource: string, pageModuleSource: string): string;
5
+ /** The expression the host evaluates in a world to call one page-module function with JSON arguments. */
6
+ export declare function pageCallJs(fn: string, args: unknown): string;
7
+ export declare class ActError extends Error {
8
+ readonly code: string;
9
+ readonly hint?: string | undefined;
10
+ readonly extra?: Record<string, unknown> | undefined;
11
+ constructor(code: string, message: string, hint?: string | undefined, extra?: Record<string, unknown> | undefined);
12
+ }
13
+ /** Restore page errors after the JSON boundary, including observation and frame-routing failures. */
14
+ export declare function unwrapPageResult(value: unknown): unknown;
15
+ /** Compile an agent target into a Playwright selector (the same engines the plugin uses). */
16
+ export declare function targetToSelector(t: ActTarget): string | null;
17
+ /** Secondary selector tried when the primary finds nothing (e.g. label → placeholder). */
18
+ export declare function fallbackSelector(t: ActTarget): string | null;
19
+ /** Normalize `target.frame` into ordered steps (outermost first); accepts arrays and Codex's `a >> internal:control=enter-frame >> b`. */
20
+ export declare function frameSteps(frame: FrameStep | FrameStep[] | undefined): FrameStep[];
21
+ type KeyDef = {
22
+ key: string;
23
+ code: string;
24
+ keyCode: number;
25
+ text?: string;
26
+ };
27
+ export declare function parseKey(spec: string): {
28
+ def: KeyDef;
29
+ modifiers: number;
30
+ };
31
+ /** What a runtime edge provides: page-module calls in the target world, raw CDP on the attached target, cursor, navigation wait. */
32
+ export interface ActIO {
33
+ /** Call `globalThis.__browsermcpPage.<fn>(args)` in the world the action targets. */
34
+ call(fn: string, args?: unknown, timeoutMs?: number): Promise<unknown>;
35
+ cdp(method: string, params?: Record<string, unknown>): Promise<unknown>;
36
+ /** Set files on the remembered Element in its owning isolated world/session. */
37
+ setFiles?(files: string[]): Promise<void>;
38
+ cursor?(x: number, y: number): Promise<unknown>;
39
+ /** Resolve after a navigation the action triggered has finished (or when none started within classifyMs). */
40
+ waitForNavigation?(classifyMs: number, timeoutMs: number): Promise<{
41
+ navigated: boolean;
42
+ url?: string;
43
+ }>;
44
+ /** When the world is a child frame: the frame's position in the top viewport — input events are dispatched on the tab. */
45
+ pointOffset?: {
46
+ x: number;
47
+ y: number;
48
+ };
49
+ }
50
+ export declare function performAct(io: ActIO, spec: ActSpec): Promise<ActResult>;
@@ -0,0 +1,2 @@
1
+ export declare const INJECTED_SOURCE: string;
2
+ export declare const INJECTED_VERSION = "1.63.0";
@@ -0,0 +1,256 @@
1
+ import type { FrameStep } from '../protocol.js';
2
+ /**
3
+ * Contract between the host-side engine (src/shared/engine.ts) and the page-side module
4
+ * (extension/src/page/index.ts) that runs inside the extension's isolated world next to Playwright's
5
+ * InjectedScript. Only plain JSON crosses this boundary: the host calls `globalThis.__browsermcpPage.<fn>(args)`.
6
+ */
7
+ export declare const ENGINE_GLOBAL = "__browsermcpInjected";
8
+ export declare const PAGE_GLOBAL = "__browsermcpPage";
9
+ export interface ResolveArgs {
10
+ selector: string;
11
+ fallback: string | null;
12
+ /** strict: several matches are only accepted when exactly one is visible */
13
+ strict: boolean;
14
+ /** actionability states to require, e.g. ['visible','enabled','editable'] */
15
+ states: string[];
16
+ align: {
17
+ block: string;
18
+ inline: string;
19
+ };
20
+ }
21
+ export interface Candidate {
22
+ tag: string;
23
+ role: string;
24
+ text: string;
25
+ ref: string | null;
26
+ visible: boolean;
27
+ box: Box;
28
+ }
29
+ export interface Box {
30
+ x: number;
31
+ y: number;
32
+ w: number;
33
+ h: number;
34
+ }
35
+ export interface Resolved {
36
+ ok: true;
37
+ x: number;
38
+ y: number;
39
+ matches_n: number;
40
+ tag: string;
41
+ hit: 'target' | 'other';
42
+ blocker: string | null;
43
+ editable: boolean;
44
+ checkable: boolean;
45
+ checked: boolean;
46
+ isSelect: boolean;
47
+ /** opaque Element ref shared across observation and action */
48
+ ref: string | null;
49
+ /** Playwright-generated selector for replay */
50
+ selector: string | null;
51
+ usedSelector: string;
52
+ }
53
+ export interface ResolveFail {
54
+ error: {
55
+ code: string;
56
+ message: string;
57
+ hint?: string;
58
+ candidates?: Candidate[];
59
+ };
60
+ retry?: boolean;
61
+ }
62
+ export type ResolveOutcome = Resolved | ResolveFail;
63
+ export interface FindArgs {
64
+ selector: string;
65
+ fallback: string | null;
66
+ limit: number;
67
+ }
68
+ export interface FindEntry {
69
+ nth: number;
70
+ ref: string | null;
71
+ selector: string | null;
72
+ tag: string;
73
+ role: string;
74
+ name: string;
75
+ text: string;
76
+ attrs: Record<string, string>;
77
+ visible: boolean;
78
+ enabled: boolean | null;
79
+ editable: boolean | null;
80
+ box: Box;
81
+ }
82
+ export interface FindResult {
83
+ matches_n: number;
84
+ visible_n: number;
85
+ selector: string;
86
+ entries: FindEntry[];
87
+ }
88
+ export interface QueryFindResult {
89
+ matches_n: number;
90
+ entries: Array<FindEntry & {
91
+ path: string[];
92
+ interactiveAncestorRef: string | null;
93
+ }>;
94
+ }
95
+ export interface AriaArgs {
96
+ selector?: string;
97
+ fallback?: string | null;
98
+ /** only the subtree of elements intersecting the viewport */
99
+ viewport?: boolean;
100
+ /** open one branch of a previous snapshot (opaque ref). Ignores viewport so an off-screen branch can be read. */
101
+ ref?: string;
102
+ }
103
+ /** Compact DOM evidence. Truncated fields can be read exactly with tab.read({target:{ref}}). */
104
+ export interface DomEntry {
105
+ ref: string;
106
+ tag: string;
107
+ text: string;
108
+ attrs: Record<string, string>;
109
+ truncated: boolean;
110
+ }
111
+ export interface DomSnapshot {
112
+ entries: DomEntry[];
113
+ total: number;
114
+ start: number;
115
+ nextStart?: number;
116
+ scope: 'viewport' | 'document'; /** Continue the live control list with tab.observe(dom.next). */
117
+ next?: {
118
+ format: 'dom';
119
+ frame?: FrameStep[];
120
+ target?: Target;
121
+ start: number;
122
+ limit?: number;
123
+ viewport: boolean;
124
+ includeFrames: false;
125
+ };
126
+ }
127
+ export interface ObserveFrameArgs extends AriaArgs {
128
+ format?: 'aria' | 'dom';
129
+ start?: number;
130
+ limit?: number;
131
+ }
132
+ export interface FrameOwner {
133
+ ref: string;
134
+ id: string;
135
+ name: string;
136
+ src: string;
137
+ }
138
+ export interface FrameObservation {
139
+ state?: string;
140
+ dom?: DomSnapshot;
141
+ children: FrameOwner[];
142
+ warnings?: string[];
143
+ }
144
+ /** Full current DOM evidence for one element; no preview clipping. */
145
+ export interface ElementDetails {
146
+ ref: string;
147
+ tag: string;
148
+ name: string;
149
+ text: string;
150
+ attrs: Record<string, string>;
151
+ }
152
+ export interface ReadTextArgs {
153
+ maxChars?: number;
154
+ start?: number;
155
+ readId?: string;
156
+ maxSteps?: number;
157
+ waitMs?: number;
158
+ }
159
+ /** Linear document text from one bounded scan. `readId` and `nextStart` continue that same capture. */
160
+ export interface ReadTextResult {
161
+ readId: string;
162
+ text: string;
163
+ complete: boolean;
164
+ reason?: 'budget' | 'scan_limit' | 'unbounded' | 'stale';
165
+ chars: number;
166
+ start: number;
167
+ nextStart?: number;
168
+ }
169
+ export interface DomClickArgs {
170
+ selector: string;
171
+ fallback: string | null;
172
+ }
173
+ export interface UploadTarget {
174
+ ok: true;
175
+ ref: string | null;
176
+ selector: string | null;
177
+ matches_n: number;
178
+ }
179
+ export interface DomClickOk {
180
+ ok: true;
181
+ ref: string | null;
182
+ tag: string;
183
+ selector: string | null;
184
+ x: number;
185
+ y: number;
186
+ }
187
+ export type DomClickResult = DomClickOk | ResolveFail;
188
+ export interface PointInfo {
189
+ tag: string;
190
+ editable: boolean;
191
+ isSelect: boolean;
192
+ }
193
+ export interface FrameProbeResult {
194
+ found: boolean;
195
+ sameOrigin?: boolean;
196
+ x?: number;
197
+ y?: number;
198
+ src?: string;
199
+ }
200
+ export interface SettleArgs {
201
+ maxMs: number;
202
+ quietMs: number;
203
+ }
204
+ export interface SelectResult {
205
+ selected?: string[];
206
+ error?: string;
207
+ available?: string[];
208
+ }
209
+ export interface ElementAtResult {
210
+ matches_n: number;
211
+ entries: FindEntry[];
212
+ }
213
+ /** What a flow expects of the page at a step; every field given must hold. */
214
+ export type Target = ({
215
+ frame?: FrameStep | FrameStep[]; /** container (css/selector/ref) to resolve inside */
216
+ within?: string;
217
+ }) & ({
218
+ ref: number | string;
219
+ } | {
220
+ selector: string;
221
+ nth?: number;
222
+ } | {
223
+ role?: string;
224
+ name?: string;
225
+ label?: string;
226
+ text?: string;
227
+ testid?: string;
228
+ nth?: number;
229
+ } | {
230
+ x: number;
231
+ y: number;
232
+ });
233
+ export interface Expectation {
234
+ target?: Target;
235
+ text?: string;
236
+ notText?: string;
237
+ url?: string;
238
+ title?: string;
239
+ visible?: boolean;
240
+ value?: string;
241
+ checked?: boolean;
242
+ selected?: string[];
243
+ enabled?: boolean;
244
+ }
245
+ /** Compiled once by the host; evaluated in the target document. */
246
+ export interface CheckArgs extends Omit<Expectation, 'target'> {
247
+ selector?: string;
248
+ fallback?: string | null;
249
+ }
250
+ export interface CheckResult {
251
+ ok: boolean;
252
+ failed: string[];
253
+ url: string;
254
+ title: string;
255
+ actual?: Record<string, unknown>;
256
+ }
@@ -0,0 +1,28 @@
1
+ import type { Arg } from '@jackwener/browsermcp/adapter-sdk';
2
+ export type { Arg } from '@jackwener/browsermcp/adapter-sdk';
3
+ export interface ToolDefinition {
4
+ site: string;
5
+ name: string;
6
+ description: string;
7
+ access: 'read' | 'write';
8
+ domain?: string;
9
+ result?: {
10
+ kind: 'rows' | 'value';
11
+ description: string;
12
+ fields?: Record<string, string>;
13
+ paginated?: boolean;
14
+ };
15
+ args?: Arg[];
16
+ /** JS source of the adapter body: `async ({ tab, args, sites, recon }) => …` */
17
+ func: string;
18
+ }
19
+ export declare function validateDefinition(def: ToolDefinition): void;
20
+ /** Ensure the user source dir can resolve the SDK subpath of this browsermcp installation. */
21
+ export declare function ensureUserSource(userAdaptersDir: string): string;
22
+ export declare function renderAdapterModule(def: ToolDefinition): string;
23
+ export declare function deleteTool(site: string, name: string, userAdaptersDir: string): boolean;
24
+ export declare function listDefinedTools(userAdaptersDir: string): Array<{
25
+ site: string;
26
+ name: string;
27
+ file: string;
28
+ }>;
@@ -0,0 +1,39 @@
1
+ import { type ToolDefinition } from './define.js';
2
+ import type { CommandRunResult, CommandRunError } from './executor.js';
3
+ import { type Arg } from './schema.js';
4
+ import { type AdapterCommand } from './loader.js';
5
+ export interface DraftExpectation {
6
+ path?: string;
7
+ equals?: unknown;
8
+ minRows?: number;
9
+ }
10
+ export declare function createDraftStore(userAdaptersDir: string): {
11
+ createDraft: (def: ToolDefinition, activeFile?: string) => Promise<{
12
+ draftId: string;
13
+ site: string;
14
+ name: string;
15
+ args: Arg[];
16
+ }>;
17
+ tryDraft: (run: (cmd: AdapterCommand, args: Record<string, unknown>) => Promise<CommandRunResult | CommandRunError>, id: string, args: Record<string, unknown>, expect: DraftExpectation) => Promise<{
18
+ result: CommandRunResult | CommandRunError;
19
+ verification: ReturnType<(result: CommandRunResult | CommandRunError, expect: DraftExpectation) => {
20
+ passed: boolean;
21
+ checks: Array<{
22
+ check: string;
23
+ passed: boolean;
24
+ actual?: unknown;
25
+ }>;
26
+ }>;
27
+ }>;
28
+ activateDraft: (id: string, sourceFile: (site: string, name: string) => string | undefined) => {
29
+ site: string;
30
+ name: string;
31
+ file: string;
32
+ verifiedAt: string;
33
+ };
34
+ discardDraft: (id: string) => {
35
+ draftId: string;
36
+ discarded: true;
37
+ };
38
+ };
39
+ export type DraftStore = ReturnType<typeof createDraftStore>;
@@ -0,0 +1,34 @@
1
+ import type { AdapterCommand } from './loader.js';
2
+ import type { RuntimePage } from '../backends/page-types.js';
3
+ export interface PageProvider {
4
+ getAdapterPage(site: string): Promise<RuntimePage>;
5
+ browserAvailable(): boolean;
6
+ /** The object model bound to a page: the same `tab`/`sites`/`recon` an agent uses in `js`. */
7
+ toolContext(page: RuntimePage, site: string): Promise<Record<string, unknown>>;
8
+ }
9
+ export interface CommandRunResult {
10
+ ok: true;
11
+ site: string;
12
+ name: string;
13
+ rows?: unknown[];
14
+ value?: unknown;
15
+ nextCursor?: string;
16
+ elapsedMs: number;
17
+ }
18
+ export interface CommandRunError {
19
+ ok: false;
20
+ site: string;
21
+ name: string;
22
+ error: {
23
+ code: string;
24
+ message: string;
25
+ hint?: string;
26
+ details?: Record<string, unknown>;
27
+ };
28
+ elapsedMs: number;
29
+ }
30
+ export declare const DEFAULT_TIMEOUT_MS = 120000;
31
+ export declare function runAdapter(provider: PageProvider, cmd: AdapterCommand, rawArgs: Record<string, unknown>, opts?: {
32
+ timeoutMs?: number;
33
+ signal?: AbortSignal;
34
+ }): Promise<CommandRunResult | CommandRunError>;
@@ -0,0 +1,84 @@
1
+ import { type Arg, type ArgView } from './schema.js';
2
+ export type SourceKind = 'builtin' | 'user';
3
+ export interface Source {
4
+ dir: string;
5
+ kind: SourceKind;
6
+ }
7
+ export interface AdapterContext {
8
+ args: Record<string, unknown>;
9
+ tab: unknown;
10
+ sites: unknown;
11
+ recon: unknown;
12
+ signal?: AbortSignal;
13
+ }
14
+ /** A loaded adapter: the descriptor from the module plus its path-derived identity. */
15
+ export interface AdapterCommand {
16
+ site: string;
17
+ name: string;
18
+ description: string;
19
+ access: 'read' | 'write';
20
+ domain?: string;
21
+ result?: {
22
+ kind: 'rows' | 'value';
23
+ description: string;
24
+ fields?: Record<string, string>;
25
+ paginated?: boolean;
26
+ };
27
+ args: Arg[];
28
+ aliases?: string[];
29
+ source: SourceKind;
30
+ run: (ctx: AdapterContext) => Promise<unknown>;
31
+ }
32
+ /** One descriptor validation path for built-in, user, and draft adapters. */
33
+ export declare function adapterCommandFromDescriptor(site: string, name: string, source: SourceKind, descriptor: Record<string, unknown>): AdapterCommand;
34
+ export declare class SiteRegistry {
35
+ private sources;
36
+ loadedAt: number | null;
37
+ private index;
38
+ private indexStamp;
39
+ constructor(sources?: Source[]);
40
+ /** Replace the source list (later overrides earlier). */
41
+ setSources(sources: Source[]): void;
42
+ addSource(source: Source): void;
43
+ load(): Promise<void>;
44
+ private existingDirs;
45
+ /** Include file identity: replacing an adapter does not update its parent directory mtime. */
46
+ private stamp;
47
+ private siteDirs;
48
+ private siteAliases;
49
+ /** site -> command-name -> absolute file path (later source wins). */
50
+ private map;
51
+ private kindOf;
52
+ private importDescriptor;
53
+ private toCommand;
54
+ private buildIndex;
55
+ private all;
56
+ has(site: string): boolean;
57
+ sites(): Array<{
58
+ site: string;
59
+ aliases: string[];
60
+ commands: number;
61
+ read: number;
62
+ write: number;
63
+ domains: string[];
64
+ source: SourceKind;
65
+ sample: string[];
66
+ }>;
67
+ commandNames(site: string): string[];
68
+ sourceFile(site: string, name: string): string | undefined;
69
+ /** Command metadata for a site (from the index; loads it if cold). */
70
+ commands(site: string): Promise<Array<Omit<AdapterCommand, 'run'>>>;
71
+ /** Rank commands for a free-text query, using the in-memory index. */
72
+ search(query: string, limit?: number): Promise<Array<{
73
+ site: string;
74
+ name: string;
75
+ description: string;
76
+ score: number;
77
+ access: string;
78
+ domain?: string;
79
+ args: ArgView[];
80
+ result?: AdapterCommand['result'];
81
+ }>>;
82
+ /** Load a command with its `run` implementation. Resolves aliases via the index. */
83
+ resolve(site: string, name: string): Promise<AdapterCommand>;
84
+ }
@@ -0,0 +1,11 @@
1
+ /** One adapter argument contract drives discovery, MCP schemas, and runtime validation. */
2
+ import { type ZodTypeAny } from 'zod';
3
+ import type { Arg } from '@jackwener/browsermcp/adapter-sdk';
4
+ export type { Arg } from '@jackwener/browsermcp/adapter-sdk';
5
+ export type ArgView = Arg;
6
+ export declare function argSpec(args?: Arg[]): ArgView[];
7
+ export declare function argToZod(arg: Arg): ZodTypeAny;
8
+ export declare function argsToShape(args?: Arg[], extra?: Record<string, ZodTypeAny>): Record<string, ZodTypeAny>;
9
+ export declare function validateArgDefinitions(args?: Arg[]): void;
10
+ /** Coerce CLI-like scalar input once, then validate the same schema exposed to MCP. */
11
+ export declare function coerceArgs(cmdArgs: Arg[] | undefined, kwargs: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ /** Resolve in source, installed packages and Electron app.asar without using the host's cwd. */
2
+ export declare function getPackageVersion(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackwener/browsermcp",
3
- "version": "0.0.36",
3
+ "version": "0.0.37-embedded.0",
4
4
  "description": "Chrome-backed MCP browser service with optional site adapters.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "browsermcp": "dist/src/main.js"
20
20
  },
21
21
  "scripts": {
22
- "build": "node scripts/clean.mjs && node scripts/extract-playwright-injected.mjs && tsc -p tsconfig.json && node scripts/gen-api-reference.mjs && node scripts/render-icons.mjs && node scripts/build-extension.mjs && node scripts/copy-assets.mjs",
22
+ "build": "node scripts/clean.mjs && node scripts/extract-playwright-injected.mjs && tsc -p tsconfig.json && node scripts/gen-api-reference.mjs && node scripts/render-icons.mjs && node scripts/build-extension.mjs && node scripts/copy-assets.mjs && node scripts/build-embedded.mjs",
23
23
  "build:ext": "node scripts/render-icons.mjs && node scripts/build-extension.mjs",
24
24
  "dev": "tsx src/main.ts",
25
25
  "test": "vitest run",
@@ -32,7 +32,10 @@
32
32
  "pack:store": "npm run build && node scripts/pack-extension.mjs store",
33
33
  "pack:manual": "npm run build && node scripts/pack-extension.mjs manual",
34
34
  "smoke:native": "node scripts/smoke-native-capabilities.mjs",
35
- "generate:chrome": "node scripts/gen-chrome-reference.mjs"
35
+ "generate:chrome": "node scripts/gen-chrome-reference.mjs",
36
+ "build:embedded": "tsc -p tsconfig.json && node scripts/build-embedded.mjs && node scripts/copy-assets.mjs",
37
+ "smoke:embedded": "npm run build:embedded && node scripts/run-embedded-smoke.mjs",
38
+ "smoke:embedded:package": "npm run build:embedded && node scripts/smoke-embedded-package.mjs"
36
39
  },
37
40
  "files": [
38
41
  "dist/",
@@ -60,9 +63,11 @@
60
63
  "zod": "^4.6.5"
61
64
  },
62
65
  "devDependencies": {
66
+ "@electron/asar": "^4.3.1",
63
67
  "@resvg/resvg-js": "^2.6.2",
64
68
  "@types/chrome": "^0.3.0",
65
69
  "@types/node": "^22.20.3",
70
+ "electron": "^44.9.0",
66
71
  "esbuild": "^0.28.2",
67
72
  "playwright-core": "^1.63.0",
68
73
  "tsx": "^4.23.13",
@@ -73,6 +78,10 @@
73
78
  "./adapter-sdk": {
74
79
  "types": "./adapter-sdk/index.d.ts",
75
80
  "default": "./adapter-sdk/index.js"
81
+ },
82
+ "./embedded": {
83
+ "types": "./dist/src/embedded/index.d.ts",
84
+ "default": "./dist/src/embedded/index.js"
76
85
  }
77
86
  }
78
87
  }