🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@mearl/native-host

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mearl/native-host - npm Package Compare versions

Comparing version
2.0.2
to
2.1.0
+34
dist/agent/executable-resolver.d.ts
export type AgentExecutableResolution = {
executable: string;
error: null;
} | {
executable: null;
error: string;
};
interface AgentExecutableResolverOptions {
candidates: () => string[];
probe: (executable: string) => Promise<string | null>;
notFoundError: string;
unusableError: string;
onFailure?: (executable: string, error: string) => void;
}
interface AgentExecutableProbeOptions {
args: string[];
timeoutMs: number;
timeoutError: string;
startError: (error: Error) => string;
exitError: (code: number | null) => string;
}
export declare class AgentExecutableResolver {
private readonly options;
private resolvedExecutable;
private resolutionPromise;
private generation;
constructor(options: AgentExecutableResolverOptions);
resolve(): Promise<AgentExecutableResolution>;
reset(): void;
private probeCandidates;
}
export declare function executableFileCandidates(candidates: Array<string | null | undefined>): string[];
export declare function probeAgentExecutable(executable: string, options: AgentExecutableProbeOptions): Promise<string | null>;
export {};
/** CDP handler for changing one named cookie in the current page scope. */
import type { PageSession } from './cdp-session.js';
export declare function cdpSetCookie(session: PageSession, data: any): Promise<any>;
export declare function cdpGetCookie(session: PageSession, data: any): Promise<any>;
/**
* Browser-level CDP control release.
*
* Closes Mearl's browser/page WebSocket sessions while keeping Chrome and all
* targets alive. A later browser action may create a fresh CdpSession.
*/
import type { CdpSession } from './cdp-session.js';
export interface CdpReleaseResult {
released: boolean;
hadActiveControl: boolean;
affectedTabIds: number[];
}
export declare function releaseCdpControl(session: CdpSession): Promise<CdpReleaseResult>;
export declare const NATIVE_HOST_VERSION: string;
+4
-1

@@ -11,2 +11,3 @@ import type { AgentChatImageInput, AgentChatModelInfo, AgentChatProviderDescriptor, AgentInstalledSkill } from '@mearl/browser-core';

private readonly clientVersion;
private readonly mearlSocketPath?;
readonly id = "codex";

@@ -21,3 +22,4 @@ private process;

private sessionModels;
constructor(log: (...args: any[]) => void, clientVersion: string);
private readonly executableResolver;
constructor(log: (...args: any[]) => void, clientVersion: string, mearlSocketPath?: string | undefined);
getDescriptor(): Promise<AgentChatProviderDescriptor>;

@@ -49,2 +51,3 @@ onEvent(listener: (event: AgentProviderEvent) => void): () => void;

private resolveExecutable;
private resolveExecutableCandidates;
}
+2
-0

@@ -21,2 +21,3 @@ import * as acp from '@agentclientprotocol/sdk';

private nextTurnId;
private readonly executableResolver;
constructor(log: (...args: any[]) => void, clientVersion: string);

@@ -52,3 +53,4 @@ getDescriptor(): Promise<AgentChatProviderDescriptor>;

private resolveExecutable;
private resolveExecutableCandidates;
private emit;
}

@@ -0,1 +1,3 @@

export declare function setAnalyticsClientId(value: unknown): boolean;
export declare function classifyAnalyticsError(error: unknown): string;
export declare function trackAction(action: string, params?: Record<string, string | number | boolean>): void;

@@ -11,2 +11,3 @@ /**

*/
import type { ControlSource } from '@mearl/browser-core';
import type { CdpSession, PageSession } from './cdp-session.js';

@@ -16,3 +17,3 @@ export interface BrowserAction {

session: 'browser';
handler: (session: CdpSession, data: any) => Promise<any>;
handler: (session: CdpSession, data: any, controlSource: ControlSource) => Promise<any>;
}

@@ -22,3 +23,3 @@ export interface PageAction {

session: 'page';
handler: (session: PageSession, data: any) => Promise<any>;
handler: (session: PageSession, data: any, controlSource: ControlSource) => Promise<any>;
}

@@ -38,2 +39,2 @@ export type CdpAction = BrowserAction | PageAction;

*/
export declare function dispatchCdpAction(cdpSession: CdpSession, action: string, data: any): Promise<any>;
export declare function dispatchCdpAction(cdpSession: CdpSession, action: string, data: any, controlSource?: ControlSource): Promise<any>;

@@ -6,3 +6,3 @@ /**

*/
import type { MtopRequest, RumEvent, ConsoleLog } from '@mearl/browser-core';
import type { MtopRequest, RumEvent, ConsoleLog, RequestBufferAccounting } from '@mearl/browser-core';
import type { CdpClient, CdpChildSession } from './client.js';

@@ -44,2 +44,3 @@ interface PartialRequest {

requestCounter: number;
requestBufferAccounting: RequestBufferAccounting;
}

@@ -46,0 +47,0 @@ export declare function createBuffers(): CdpBuffers;

@@ -63,3 +63,6 @@ /**

private fetchVersionInfo;
hasActiveConnections(): boolean;
listOpenPageSessions(): PageSession[];
listRegisteredTabIds(targetIds?: ReadonlySet<string>): number[];
close(): void;
}

@@ -10,4 +10,4 @@ /**

import type { CdpSession } from './cdp-session.js';
import { type PageActAction } from '@mearl/browser-core';
export declare function cdpRunActions(session: CdpSession, data: any): Promise<any>;
import { type ControlSource, type PageActAction } from '@mearl/browser-core';
export declare function cdpRunActions(session: CdpSession, data: any, controlSource?: ControlSource): Promise<any>;
/**

@@ -20,2 +20,2 @@ * Runs a page interaction action with built-in observation: executes the raw

*/
export declare function cdpObservedPageAction(session: CdpSession, action: PageActAction, data: any): Promise<any>;
export declare function cdpObservedPageAction(session: CdpSession, action: PageActAction, data: any, controlSource?: ControlSource): Promise<any>;
/**
* CDP 模式的受控页面视觉标识。
*
* 与扩展模式的 favicon 替换保持一致:agent 操作过的页面把 favicon 换成 Mearl
* 图标。CDP 模式拿不到扩展资源,图标以 data URL 内联在注入脚本里,不依赖任何
* 网络请求。
* 与扩展模式共享同一套 Mearl favicon 变体,本地操作显示绿色圆点角标,云端操作
* 显示紫色云朵角标。图标通过 data URL 内联到新文档脚本,不依赖扩展资源或网络。
*
* 注入通过 Page.addScriptToEvaluateOnNewDocument + runImmediately 完成:每个
* PageSession 只注册一次,注册的脚本在 session 存续期内跨导航自动生效;
* session 断开重建后由下一次动作重新注册。
* 注入通过 Page.addScriptToEvaluateOnNewDocument + runImmediately 完成:脚本在
* PageSession 存续期内跨导航生效;控制来源变化时替换脚本并立即更新当前文档。
*/
import { type ControlSource } from '@mearl/browser-core';
import type { PageSession } from './cdp-session.js';
/**
* 确保受控标识已注入到该 page session。幂等且 best-effort:
* 失败时撤销标记,下一次动作重试;任何异常都不阻断 agent 动作本身。
* 确保受控标识已注入到该 page session。相同来源幂等;来源变化时替换跨导航脚本,
* runImmediately 同步更新当前文档。任何异常都不阻断 agent 动作本身。
*/
export declare function ensureControlledIndicator(session: PageSession): Promise<void>;
export declare function ensureControlledIndicator(session: PageSession, controlSource?: ControlSource): Promise<void>;
/** browser_release 使用:停止跨导航注入并恢复当前文档的 favicon。 */
export declare function releaseControlledIndicator(session: PageSession): Promise<void>;

@@ -15,2 +15,3 @@ /**

import './timezone-handlers.js';
import './cookie-handlers.js';
import './snapshot-handlers.js';

@@ -31,1 +32,2 @@ import './recording-handlers.js';

export { cdpSetTimezone } from './timezone-handlers.js';
export { cdpGetCookie, cdpSetCookie } from './cookie-handlers.js';

@@ -5,3 +5,5 @@ /**

import type { PageSession } from './cdp-session.js';
/** browser_release 使用:丢弃所有依赖当前 CDP 会话的 mock 状态。 */
export declare function clearCdpMockState(): void;
export declare function cdpSetMock(session: PageSession, data: any): Promise<any>;
export declare function cdpGetMocks(_session: PageSession, _data: any): any;

@@ -10,1 +10,3 @@ /**

export declare function cdpRecordStop(session: PageSession, _data: any): Promise<any>;
/** browser_release 使用:停止仍存活页面的录制,并丢弃已失效 target 的残留状态。 */
export declare function releaseCdpRecordings(sessions: PageSession[]): Promise<void>;
/**
* CDP tab management handlers.
*/
import { type ControlSource } from '@mearl/browser-core';
import type { CdpSession } from './cdp-session.js';
export declare function cdpTabOpen(session: CdpSession, data: any): Promise<any>;
export declare function cdpTabOpen(session: CdpSession, data: any, controlSource?: ControlSource): Promise<any>;
export declare function cdpTabClose(session: CdpSession, data: any): Promise<any>;
export declare function cdpTabList(session: CdpSession, _data: any): Promise<any>;
export declare function isInternalExtensionAction(action: unknown): boolean;
export declare function createExtensionRequestMessage(id: string, action: string, data: any, trustedInternal?: boolean): {
export declare function createExtensionRequestMessage(id: string, action: string, data: any, trustedInternal?: boolean, controlSource?: 'local' | 'cloud'): {
id: string;
action: string;
data: any;
controlSource: 'local' | 'cloud';
trustedInternal?: true;
};
{
"name": "@mearl/native-host",
"version": "2.0.2",
"version": "2.1.0",
"description": "Native Messaging Host for Mearl — bridges Chrome Extension and local socket server",

@@ -35,4 +35,4 @@ "type": "module",

"typescript": "^5.8.3",
"@mearl/browser-core": "2.0.2",
"@mearl/daemon-core": "2.0.2"
"@mearl/browser-core": "2.1.0",
"@mearl/daemon-core": "2.1.0"
},

@@ -39,0 +39,0 @@ "scripts": {

Sorry, the diff of this file is too big to display