@pi-oxide/extension-js 0.13.0 → 0.13.3
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/content-script.js +3 -3
- package/extension_js.d.ts +51 -48
- package/extension_js.js +104029 -26174
- package/index.js +1260 -1115
- package/package.json +2 -5
- package/worker.js +483 -474
- package/content-script/action-result.d.ts +0 -4
- package/content-script/dom-tree.d.ts +0 -28
- package/content-script/dom-utils.d.ts +0 -37
- package/content-script/file-resolution.d.ts +0 -22
- package/content-script/form-validation.d.ts +0 -12
- package/content-script/handlers.d.ts +0 -3
- package/content-script/index.d.ts +0 -6
- package/content-script/listbox.d.ts +0 -7
- package/content-script/logger.d.ts +0 -12
- package/content-script/message-router.d.ts +0 -1
- package/content-script/observation-lease.d.ts +0 -55
- package/content-script/registry.d.ts +0 -24
- package/content-script/schemas.d.ts +0 -5
- package/content-script/snapshot.d.ts +0 -3
- package/main/index.d.ts +0 -8
- package/main/runner/chrome/internals.d.ts +0 -9
- package/main/runner/chrome/native.d.ts +0 -6
- package/main/runner/command.d.ts +0 -3
- package/main/runner/dom/snapshot.d.ts +0 -8
- package/main/runner/fetch.d.ts +0 -4
- package/main/runner/host.d.ts +0 -3
- package/main/runner/index.d.ts +0 -2
- package/main/runner/lib/constants.d.ts +0 -14
- package/main/runner/lib/host-registry.d.ts +0 -6
- package/main/runner/lib/network-tracker.d.ts +0 -16
- package/main/runner/lib/params-helpers.d.ts +0 -2
- package/main/runner/lib/params.d.ts +0 -5
- package/main/runner/lib/types.d.ts +0 -116
- package/main/runner/runtime.d.ts +0 -15
- package/main/runner/sidepanel/dom.d.ts +0 -6
- package/main/runner/snapshot-merge.d.ts +0 -8
- package/main/runner/tab/execute.d.ts +0 -24
- package/main/runner/tools/aliases.d.ts +0 -1
- package/main/runner/tools/chrome/action.d.ts +0 -1
- package/main/runner/tools/chrome/alarms.d.ts +0 -1
- package/main/runner/tools/chrome/bookmarks.d.ts +0 -1
- package/main/runner/tools/chrome/browsing-data.d.ts +0 -1
- package/main/runner/tools/chrome/capability.d.ts +0 -30
- package/main/runner/tools/chrome/context-menus.d.ts +0 -1
- package/main/runner/tools/chrome/cookies.d.ts +0 -1
- package/main/runner/tools/chrome/declarative-net-request.d.ts +0 -1
- package/main/runner/tools/chrome/desktop-capture.d.ts +0 -1
- package/main/runner/tools/chrome/downloads.d.ts +0 -1
- package/main/runner/tools/chrome/history.d.ts +0 -1
- package/main/runner/tools/chrome/identity.d.ts +0 -1
- package/main/runner/tools/chrome/idle.d.ts +0 -1
- package/main/runner/tools/chrome/index.d.ts +0 -1
- package/main/runner/tools/chrome/management.d.ts +0 -1
- package/main/runner/tools/chrome/notifications.d.ts +0 -1
- package/main/runner/tools/chrome/offscreen.d.ts +0 -1
- package/main/runner/tools/chrome/page-capture.d.ts +0 -1
- package/main/runner/tools/chrome/permissions.d.ts +0 -1
- package/main/runner/tools/chrome/register-helpers.d.ts +0 -9
- package/main/runner/tools/chrome/runtime.d.ts +0 -1
- package/main/runner/tools/chrome/scripting.d.ts +0 -1
- package/main/runner/tools/chrome/sessions.d.ts +0 -1
- package/main/runner/tools/chrome/side-panel.d.ts +0 -1
- package/main/runner/tools/chrome/system.d.ts +0 -1
- package/main/runner/tools/chrome/tab-groups.d.ts +0 -1
- package/main/runner/tools/chrome/tabs.d.ts +0 -1
- package/main/runner/tools/chrome/top-sites.d.ts +0 -1
- package/main/runner/tools/chrome/windows.d.ts +0 -1
- package/main/runner/tools/chrome-storage.d.ts +0 -1
- package/main/runner/tools/clipboard.d.ts +0 -1
- package/main/runner/tools/dom.d.ts +0 -1
- package/main/runner/tools/host-call.d.ts +0 -1
- package/main/runner/tools/network.d.ts +0 -1
- package/main/runner/tools/page.d.ts +0 -1
- package/main/runner/tools/sidepanel.d.ts +0 -1
- package/main/runner/tools/storage.d.ts +0 -1
- package/main/runner/tools/tab.d.ts +0 -1
- package/main/session/extension-session.d.ts +0 -106
- package/main/tab-context.d.ts +0 -12
- package/shared/array-buffer.d.ts +0 -4
- package/shared/collect-inline-snapshot.d.ts +0 -50
- package/shared/cross/agent-errors.d.ts +0 -28
- package/shared/cross/array-buffer.d.ts +0 -4
- package/shared/cross/collect-inline-snapshot.d.ts +0 -58
- package/shared/cross/content-script-actions.d.ts +0 -7
- package/shared/cross/content-script-tools.d.ts +0 -3
- package/shared/cross/dispatch.d.ts +0 -5
- package/shared/cross/fetch-response.d.ts +0 -12
- package/shared/cross/format-types.d.ts +0 -43
- package/shared/cross/fs-types.d.ts +0 -81
- package/shared/cross/generated.d.ts +0 -328
- package/shared/cross/manifest.d.ts +0 -130
- package/shared/cross/normalize-agent-error.d.ts +0 -17
- package/shared/cross/page-specs.d.ts +0 -7
- package/shared/cross/schemas/chrome.d.ts +0 -56
- package/shared/cross/schemas/clipboard.d.ts +0 -19
- package/shared/cross/schemas/fs.d.ts +0 -65
- package/shared/cross/schemas/helpers.d.ts +0 -71
- package/shared/cross/schemas/host.d.ts +0 -15
- package/shared/cross/schemas/network.d.ts +0 -34
- package/shared/cross/schemas/page.d.ts +0 -494
- package/shared/cross/schemas/returns.d.ts +0 -8791
- package/shared/cross/schemas/sidepanel.d.ts +0 -284
- package/shared/cross/schemas/snapshot.d.ts +0 -272
- package/shared/cross/schemas/storage.d.ts +0 -60
- package/shared/cross/schemas/tab.d.ts +0 -597
- package/shared/cross/schemas.d.ts +0 -12
- package/shared/cross/snapshot-filter.d.ts +0 -15
- package/shared/cross/tab-specs.d.ts +0 -3
- package/shared/cross/types.d.ts +0 -12
- package/shared/cross/zod-to-docs.d.ts +0 -28
- package/shared/cs/ref-id.d.ts +0 -5
- package/shared/cs/snapshot-dom.d.ts +0 -47
- package/shared/fetch-response.d.ts +0 -12
- package/shared/fs-types.d.ts +0 -81
- package/shared/generated.d.ts +0 -241
- package/shared/log-levels.d.ts +0 -5
- package/shared/logger.d.ts +0 -18
- package/shared/main/content-script-response.d.ts +0 -5
- package/shared/main/define-content-script-tool.d.ts +0 -7
- package/shared/main/log-levels.d.ts +0 -5
- package/shared/main/logger.d.ts +0 -18
- package/shared/main/routes.d.ts +0 -14
- package/shared/main/tool-registry.d.ts +0 -19
- package/shared/ref-id.d.ts +0 -5
- package/shared/registry/agent-errors.d.ts +0 -27
- package/shared/registry/content-script-actions.d.ts +0 -7
- package/shared/registry/content-script-response.d.ts +0 -5
- package/shared/registry/content-script-tools.d.ts +0 -13
- package/shared/registry/define-content-script-tool.d.ts +0 -7
- package/shared/registry/dispatch.d.ts +0 -5
- package/shared/registry/manifest.d.ts +0 -130
- package/shared/registry/normalize-agent-error.d.ts +0 -17
- package/shared/registry/routes.d.ts +0 -14
- package/shared/registry/types.d.ts +0 -12
- package/shared/registry/zod-to-docs.d.ts +0 -28
- package/shared/schemas.d.ts +0 -10663
- package/shared/snapshot-dom.d.ts +0 -47
- package/shared/snapshot-filter.d.ts +0 -15
- package/shared/tool-registry.d.ts +0 -19
- package/worker/binary-blob-store.d.ts +0 -12
- package/worker/fetch-store.d.ts +0 -1
- package/worker/resolve-set-files.d.ts +0 -22
- package/worker/vfs-write-cache.d.ts +0 -3
- package/worker/worker.d.ts +0 -84
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PageActionResult } from '../shared/cross/schemas.js';
|
|
2
|
-
|
|
3
|
-
export declare function makeActionResult(action: string, el: Element | null, extras?: Record<string, unknown>): PageActionResult;
|
|
4
|
-
export declare function assertFillEffect(action: string, el: Element, refId: string, requested: string): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type DomNode = {
|
|
2
|
-
refId?: string;
|
|
3
|
-
tag: string;
|
|
4
|
-
role?: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
text?: string;
|
|
7
|
-
attributes?: Record<string, string>;
|
|
8
|
-
hidden?: boolean;
|
|
9
|
-
hiddenReason?: "display-none" | "visibility-hidden" | "aria-hidden" | "opacity-zero" | "hidden-attr" | "inert";
|
|
10
|
-
value?: string;
|
|
11
|
-
checked?: boolean;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
readOnly?: boolean;
|
|
14
|
-
href?: string;
|
|
15
|
-
src?: string;
|
|
16
|
-
alt?: string;
|
|
17
|
-
accept?: string;
|
|
18
|
-
filesCount?: number;
|
|
19
|
-
controlType?: string;
|
|
20
|
-
recommendedAction?: string;
|
|
21
|
-
controls?: string;
|
|
22
|
-
expanded?: boolean;
|
|
23
|
-
children?: DomNode[];
|
|
24
|
-
};
|
|
25
|
-
export declare function buildDomNode(el: Element, depth: number, includeHidden: boolean, observed?: Array<{
|
|
26
|
-
refId: string;
|
|
27
|
-
element: Element;
|
|
28
|
-
}>): DomNode | null;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { enrichFormNode, getAccessibleName, getAccessibleRole, shouldInclude } from '../shared/cs/snapshot-dom.js';
|
|
2
|
-
|
|
3
|
-
export { enrichFormNode, getAccessibleName, getAccessibleRole, shouldInclude };
|
|
4
|
-
/**
|
|
5
|
-
* Find an element by its opaque reference ID.
|
|
6
|
-
* @param refId — opaque element ref in 'e{N}' format (e.g. 'e2'). Must match schema regex ^e\d+$.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getElementByRefId(refId: string): Element | null;
|
|
9
|
-
export declare function assertInteractable(el: Element, action: string): void;
|
|
10
|
-
export declare function findElementByLabel(query: string): Element | null;
|
|
11
|
-
export declare function findCandidateLabels(query: string): string[];
|
|
12
|
-
export type SemanticCandidate = {
|
|
13
|
-
refId: string;
|
|
14
|
-
role?: string;
|
|
15
|
-
name?: string;
|
|
16
|
-
};
|
|
17
|
-
export declare function findSemanticCandidates(query: string): SemanticCandidate[];
|
|
18
|
-
export declare function asRecord(obj: unknown): Record<string, unknown>;
|
|
19
|
-
export declare function getStringParam(params: unknown, key: string): string;
|
|
20
|
-
export declare function getNumberParam(params: unknown, key: string, fallback: number): number;
|
|
21
|
-
export declare function findCandidatesByRefId(refId: string): SemanticCandidate[];
|
|
22
|
-
export declare function throwElementNotFound(refId: string | undefined, label: string | undefined, includeCandidates?: boolean): never;
|
|
23
|
-
/**
|
|
24
|
-
* Resolve an element by refId (raw querySelector) with a label fallback.
|
|
25
|
-
*
|
|
26
|
-
* INTENTIONAL non-lease path: this deliberately bypasses the observation lease
|
|
27
|
-
* (requireTarget / requireTargetByLabel). The handlers that use this — type,
|
|
28
|
-
* append, select, check, hover, dblclick, set_files, scroll_to — mutate stable
|
|
29
|
-
* elements that rarely change between snapshot and action, so the lease's
|
|
30
|
-
* stale-element / fingerprint strictness is unnecessary here and would reject
|
|
31
|
-
* valid targets. Only `click` (and fill's refId path) use lease validation.
|
|
32
|
-
*
|
|
33
|
-
* Do NOT "unify" these handlers onto requireTarget — that changes behavior the
|
|
34
|
-
* project has explicitly chosen. If you need lease-validated resolution, use
|
|
35
|
-
* requireTarget/requireTargetByLabel directly (as click does).
|
|
36
|
-
*/
|
|
37
|
-
export declare function resolveTargetRaw(refId: string | undefined, label: string | undefined): Element;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File-input resolution for `set_files`. Resolves worker-processed file
|
|
3
|
-
* payloads (base64 bytes or fetched URL) into real `File` objects and
|
|
4
|
-
* verifies they landed on the input.
|
|
5
|
-
*/
|
|
6
|
-
export type ResolvedBytesFile = {
|
|
7
|
-
kind: "bytes";
|
|
8
|
-
name: string;
|
|
9
|
-
data: string;
|
|
10
|
-
mimeType?: string;
|
|
11
|
-
};
|
|
12
|
-
export type ResolvedUrlFile = {
|
|
13
|
-
kind: "url";
|
|
14
|
-
url: string;
|
|
15
|
-
name: string;
|
|
16
|
-
mimeType?: string;
|
|
17
|
-
};
|
|
18
|
-
export type ResolvedSetFile = ResolvedBytesFile | ResolvedUrlFile;
|
|
19
|
-
export declare function parseResolvedFiles(params: unknown): ResolvedSetFile[];
|
|
20
|
-
export declare function fileFromBytes(file: ResolvedBytesFile): File;
|
|
21
|
-
export declare function fileFromUrl(file: ResolvedUrlFile): Promise<File>;
|
|
22
|
-
export declare function assertSetFilesEffect(el: HTMLInputElement, refId: string, expectedNames: string[]): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type InvalidFormControl = {
|
|
2
|
-
refId: string | undefined;
|
|
3
|
-
tag: string;
|
|
4
|
-
role: string;
|
|
5
|
-
name: string | undefined;
|
|
6
|
-
field: string | undefined;
|
|
7
|
-
error: string;
|
|
8
|
-
value: string | undefined;
|
|
9
|
-
required: boolean;
|
|
10
|
-
validationMessage: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
export declare function invalidFormControls(form: HTMLFormElement): InvalidFormControl[];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const logger: {
|
|
2
|
-
debug: (event: string, meta?: Record<string, unknown>) => void;
|
|
3
|
-
info: (event: string, meta?: Record<string, unknown>) => void;
|
|
4
|
-
warn: (event: string, meta?: Record<string, unknown>) => void;
|
|
5
|
-
error: (event: string, meta?: Record<string, unknown>) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function initContentScriptLogger(): void;
|
|
8
|
-
declare global {
|
|
9
|
-
interface Window {
|
|
10
|
-
__jsNotebookSetLogLevel?: (level: string) => void;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function installMessageListener(): void;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { InlineSnapshotNode, InlineSnapshotResult } from '../shared/cross/collect-inline-snapshot.js';
|
|
2
|
-
|
|
3
|
-
export interface ObservedTarget {
|
|
4
|
-
element: Element;
|
|
5
|
-
fingerprint: TargetFingerprint;
|
|
6
|
-
}
|
|
7
|
-
export interface TargetFingerprint {
|
|
8
|
-
tag: string;
|
|
9
|
-
role: string;
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
/** Reset state — used by tests and on content-script load. */
|
|
13
|
-
export declare function resetLease(): void;
|
|
14
|
-
/**
|
|
15
|
-
* A snapshot succeeded; the page is now observed. Returns the new observationId.
|
|
16
|
-
* Pass the refId→element mapping so requireTarget can re-validate identity later.
|
|
17
|
-
*/
|
|
18
|
-
export declare function grantObservation(observed?: ReadonlyArray<{
|
|
19
|
-
refId: string;
|
|
20
|
-
element: Element;
|
|
21
|
-
}>): string;
|
|
22
|
-
/** Page state may have diverged; require a fresh observation before any action. */
|
|
23
|
-
export declare function invalidateLease(): void;
|
|
24
|
-
export declare function hasActiveObservation(): boolean;
|
|
25
|
-
export declare function currentObservationId(): string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Re-validate the target at action time. Throws a structured agent error if:
|
|
28
|
-
* - the lease has no active observation
|
|
29
|
-
* - the refId is not part of the latest observation
|
|
30
|
-
* - the element was disconnected or replaced
|
|
31
|
-
* - the semantic fingerprint changed (role/name/tag rewrite)
|
|
32
|
-
*
|
|
33
|
-
* Returns the validated element on success.
|
|
34
|
-
*/
|
|
35
|
-
export declare function requireTarget(refId: string, action: string): Element;
|
|
36
|
-
/**
|
|
37
|
-
* Resolve a label against the latest observation. Throws E_AMBIGUOUS_TARGET
|
|
38
|
-
* if multiple observed targets share the label. Returns the unique element.
|
|
39
|
-
*/
|
|
40
|
-
export declare function requireTargetByLabel(label: string, action: string): Element;
|
|
41
|
-
/** Re-grant snapshot attached to lease-violation errors. */
|
|
42
|
-
export interface RefreshSnapshot {
|
|
43
|
-
nodes: InlineSnapshotNode[];
|
|
44
|
-
observationId: string;
|
|
45
|
-
url: string;
|
|
46
|
-
title: string;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Collect an inline snapshot and grant the lease over every refId-bearing
|
|
50
|
-
* element it produced. Shared logic for snapshot-time grant and error-path
|
|
51
|
-
* refresh so the collect→resolve→grant sequence has one definition.
|
|
52
|
-
*/
|
|
53
|
-
export declare function grantFromInlineSnapshot(maxNodes: number): InlineSnapshotResult & {
|
|
54
|
-
observationId: string;
|
|
55
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
export type ContentScriptHandler = (params: unknown, signal?: AbortSignal) => unknown | Promise<unknown>;
|
|
4
|
-
export type ContentScriptHandlerSpec = {
|
|
5
|
-
registryAction: string;
|
|
6
|
-
handlerKey: string;
|
|
7
|
-
params: z.ZodSchema<unknown>;
|
|
8
|
-
returns: z.ZodSchema<unknown>;
|
|
9
|
-
};
|
|
10
|
-
export declare function registerContentScriptSpec(spec: ContentScriptHandlerSpec): void;
|
|
11
|
-
export declare function getContentScriptSpec(registryAction: string): ContentScriptHandlerSpec | undefined;
|
|
12
|
-
/** Register content-script handler specs and announce readiness to the host. */
|
|
13
|
-
export declare function registerContentScriptSpecs(specs: ContentScriptHandlerSpec[]): void;
|
|
14
|
-
export declare function cancelContentScriptCall(callId: string): boolean;
|
|
15
|
-
export declare function dispatchContentScriptCall(registryAction: string, _handlerKey: string, handler: ContentScriptHandler, params: unknown, callId?: string): Promise<{
|
|
16
|
-
ok: true;
|
|
17
|
-
value: unknown;
|
|
18
|
-
} | {
|
|
19
|
-
ok: false;
|
|
20
|
-
error: {
|
|
21
|
-
message: string;
|
|
22
|
-
code: string;
|
|
23
|
-
};
|
|
24
|
-
}>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ContentScriptHandlerSpec } from './registry.js';
|
|
2
|
-
|
|
3
|
-
/** Infra-only schemas for non-registryCall messages (ping connectivity probe). */
|
|
4
|
-
export declare function buildInfraContentScriptSpecs(): ContentScriptHandlerSpec[];
|
|
5
|
-
export declare function buildContentScriptSpecs(): ContentScriptHandlerSpec[];
|
package/main/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ExtensionSession } from './session/extension-session.js';
|
|
2
|
-
export type { CellResult as JsRunResult, WasmGlobalsSnapshot as JsGlobalsSnapshot, } from '../../pkg/extension_js.js';
|
|
3
|
-
export type { LogLevel } from '../shared/main/logger.js';
|
|
4
|
-
export { LOG_LEVEL_NUMERIC, setLogLevel } from '../shared/main/logger.js';
|
|
5
|
-
export { registerHostHandler, registerHostHandlers, } from './runner/index.js';
|
|
6
|
-
export { ExtensionSession } from './session/extension-session.js';
|
|
7
|
-
/** Register a MessagePort for routing registry calls to an auxiliary worker context. */
|
|
8
|
-
export declare function registerWorkerRelayPort(session: ExtensionSession, owner: string, port: MessagePort): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { AsyncError, ToolDocParam } from '../../../shared/main/tool-registry.js';
|
|
3
|
-
|
|
4
|
-
export { invokeNative, isNativeParityAction, type NativeArgs, normalizeParityArgs, requireArgumentArray, resolveChromeMethod, } from './native.js';
|
|
5
|
-
export declare function normalizeChromeError(err: unknown): {
|
|
6
|
-
ok: false;
|
|
7
|
-
error: AsyncError;
|
|
8
|
-
};
|
|
9
|
-
export declare function registerChromePassthrough(action: string, _namespace: string, description: string, apiPath: string[], returnsSchema: z.ZodSchema<unknown>, errorCode: string, errorCategory: string | undefined, paramTypes?: ToolDocParam[], example?: string, returnType?: string): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type NativeArgs = readonly unknown[];
|
|
2
|
-
export declare function isNativeParityAction(action: string): boolean;
|
|
3
|
-
export declare function invokeNative(method: (...args: unknown[]) => unknown, args: NativeArgs): unknown;
|
|
4
|
-
export declare function normalizeParityArgs(action: string, args: NativeArgs): NativeArgs;
|
|
5
|
-
export declare function requireArgumentArray(value: unknown, action: string): NativeArgs;
|
|
6
|
-
export declare function resolveChromeMethod(chromeRoot: unknown, apiPath: string[], methodName: string): (...args: unknown[]) => unknown;
|
package/main/runner/command.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AsyncResponse } from '../../../shared/main/tool-registry.js';
|
|
2
|
-
import { DomFormatParams, DomSnapshotParams, DomSnapshotValue } from '../lib/types.js';
|
|
3
|
-
|
|
4
|
-
export declare function ensureDomSnapshot(): Promise<void>;
|
|
5
|
-
export declare function handleDomSnapshot(params: DomSnapshotParams): Promise<AsyncResponse<DomSnapshotValue>>;
|
|
6
|
-
export declare function handleDomFormat(params: DomFormatParams): Promise<AsyncResponse<string>>;
|
|
7
|
-
/** Local/test entry — production snapshots use the content-script path. */
|
|
8
|
-
export declare function buildSnapshotInTab(maxNodesArg: unknown): import('../../../shared/cross/collect-inline-snapshot.js').InlineSnapshotResult;
|
package/main/runner/fetch.d.ts
DELETED
package/main/runner/host.d.ts
DELETED
package/main/runner/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { type Command, setRunnerAbortController, } from '../../shared/main/tool-registry.js';
|
|
2
|
-
export { executeMainThreadCommand, getActiveTabId, initExtensionListeners, isValidMainThreadAction, normalizeParams, registerHostHandler, registerHostHandlers, removeExtensionListeners, } from './runtime.js';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_MAX_NODES = 500;
|
|
2
|
-
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
3
|
-
export declare const DEFAULT_SCROLL_AMOUNT = 300;
|
|
4
|
-
export declare const DEFAULT_POLL_INTERVAL_MS = 100;
|
|
5
|
-
export declare const RETRY_DELAY_MS = 500;
|
|
6
|
-
export declare const INJECTION_DELAY_MS = 300;
|
|
7
|
-
/** Brief pause after tabs.update so status can transition to loading. */
|
|
8
|
-
export declare const NAVIGATION_SETTLE_MS = 100;
|
|
9
|
-
/** Grace period after content-script ping before returning from page.goto. */
|
|
10
|
-
export declare const CONTENT_SCRIPT_GRACE_MS = 500;
|
|
11
|
-
/** Fast fail-fast ping before content-script mutations (health, relay). */
|
|
12
|
-
export declare const CS_FAST_PING_MS = 500;
|
|
13
|
-
/** Quiet period with no in-flight requests before declaring network idle. */
|
|
14
|
-
export declare const NETWORK_IDLE_QUIET_MS = 500;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { HostHandler } from './types.js';
|
|
2
|
-
|
|
3
|
-
export declare const hostHandlers: Record<string, HostHandler>;
|
|
4
|
-
export declare function registerHostHandler<T, R>(action: string, handler: (params: T) => Promise<R>): void;
|
|
5
|
-
export declare function registerHostHandlers(handlers: Record<string, HostHandler>): void;
|
|
6
|
-
export declare function isValidMainThreadAction(action: string): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracks in-flight network requests for a specific tab using chrome.webRequest.
|
|
3
|
-
* Observe-only (MV3 compatible) — no request blocking or modification.
|
|
4
|
-
*/
|
|
5
|
-
export declare class NetworkTracker {
|
|
6
|
-
private readonly tabId;
|
|
7
|
-
private inFlight;
|
|
8
|
-
private onBeforeRequest;
|
|
9
|
-
private onCompleted;
|
|
10
|
-
private onErrorOccurred;
|
|
11
|
-
constructor(tabId: number);
|
|
12
|
-
start(): void;
|
|
13
|
-
get pendingCount(): number;
|
|
14
|
-
waitForIdle(timeoutMs: number, traceId?: string): Promise<void>;
|
|
15
|
-
dispose(): void;
|
|
16
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AsyncResponse } from '../../../shared/main/tool-registry.js';
|
|
2
|
-
|
|
3
|
-
export { asRecord, extractTabId } from './params-helpers.js';
|
|
4
|
-
export declare function normalizeParams(action: string, params: unknown): unknown;
|
|
5
|
-
export declare function unwrapResult<T>(result: AsyncResponse<T>): T;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { DomFormatParams, DomSnapshotParams, FetchParams, TreeSnapshot } from '../../../shared/cross/generated.js';
|
|
2
|
-
|
|
3
|
-
export type { DomFormatParams, DomSnapshotParams, FetchParams };
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
__hostHandlers?: Record<string, HostHandler>;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export type HostHandler<T = unknown, R = unknown> = (params: T) => Promise<R>;
|
|
10
|
-
export type FetchValue = {
|
|
11
|
-
status: number;
|
|
12
|
-
ok: boolean;
|
|
13
|
-
headers: Record<string, string>;
|
|
14
|
-
body: string;
|
|
15
|
-
bodyEncoding: "text" | "base64";
|
|
16
|
-
byteLength: number;
|
|
17
|
-
contentType: string;
|
|
18
|
-
finalUrl: string;
|
|
19
|
-
};
|
|
20
|
-
export type DomSnapshotValue = {
|
|
21
|
-
data: TreeSnapshot;
|
|
22
|
-
text: string;
|
|
23
|
-
};
|
|
24
|
-
export type TabMessage = {
|
|
25
|
-
action: "click";
|
|
26
|
-
params: {
|
|
27
|
-
refId?: string;
|
|
28
|
-
label?: string;
|
|
29
|
-
};
|
|
30
|
-
} | {
|
|
31
|
-
action: "fill";
|
|
32
|
-
params: {
|
|
33
|
-
refId?: string;
|
|
34
|
-
value: string;
|
|
35
|
-
label?: string;
|
|
36
|
-
};
|
|
37
|
-
} | {
|
|
38
|
-
action: "type";
|
|
39
|
-
params: {
|
|
40
|
-
refId?: string;
|
|
41
|
-
text: string;
|
|
42
|
-
label?: string;
|
|
43
|
-
};
|
|
44
|
-
} | {
|
|
45
|
-
action: "append";
|
|
46
|
-
params: {
|
|
47
|
-
refId?: string;
|
|
48
|
-
text: string;
|
|
49
|
-
label?: string;
|
|
50
|
-
};
|
|
51
|
-
} | {
|
|
52
|
-
action: "press";
|
|
53
|
-
params: {
|
|
54
|
-
key: string;
|
|
55
|
-
};
|
|
56
|
-
} | {
|
|
57
|
-
action: "select";
|
|
58
|
-
params: {
|
|
59
|
-
refId: string;
|
|
60
|
-
value: string;
|
|
61
|
-
};
|
|
62
|
-
} | {
|
|
63
|
-
action: "check";
|
|
64
|
-
params: {
|
|
65
|
-
refId: string;
|
|
66
|
-
checked: boolean;
|
|
67
|
-
};
|
|
68
|
-
} | {
|
|
69
|
-
action: "hover";
|
|
70
|
-
params: {
|
|
71
|
-
refId: string;
|
|
72
|
-
};
|
|
73
|
-
} | {
|
|
74
|
-
action: "unhover";
|
|
75
|
-
params: Record<string, never>;
|
|
76
|
-
} | {
|
|
77
|
-
action: "scroll";
|
|
78
|
-
params: {
|
|
79
|
-
direction: string;
|
|
80
|
-
amount: number;
|
|
81
|
-
};
|
|
82
|
-
} | {
|
|
83
|
-
action: "scrollTo";
|
|
84
|
-
params: {
|
|
85
|
-
x: number;
|
|
86
|
-
y: number;
|
|
87
|
-
refId?: string;
|
|
88
|
-
};
|
|
89
|
-
} | {
|
|
90
|
-
action: "dblclick";
|
|
91
|
-
params: {
|
|
92
|
-
refId: string;
|
|
93
|
-
};
|
|
94
|
-
} | {
|
|
95
|
-
action: "back";
|
|
96
|
-
params: Record<string, never>;
|
|
97
|
-
} | {
|
|
98
|
-
action: "ping";
|
|
99
|
-
params?: Record<string, never>;
|
|
100
|
-
};
|
|
101
|
-
type CodedError = Error & {
|
|
102
|
-
code: string;
|
|
103
|
-
category?: string;
|
|
104
|
-
hint?: string;
|
|
105
|
-
recovery?: string[];
|
|
106
|
-
details?: Record<string, unknown>;
|
|
107
|
-
};
|
|
108
|
-
export declare function makeError(message: string, code: string, category?: string, extra?: Pick<CodedError, "hint" | "recovery" | "details">): CodedError;
|
|
109
|
-
export declare function throwAgentError(error: {
|
|
110
|
-
message: string;
|
|
111
|
-
code: string;
|
|
112
|
-
category?: string;
|
|
113
|
-
hint?: string;
|
|
114
|
-
recovery?: string[];
|
|
115
|
-
details?: Record<string, unknown>;
|
|
116
|
-
}): never;
|
package/main/runner/runtime.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { type Command, setRunnerAbortController, throwIfAborted, } from '../../shared/main/tool-registry.js';
|
|
2
|
-
export { getActiveTabId, initExtensionListeners, removeExtensionListeners, resolveActiveTabId, } from '../tab-context.js';
|
|
3
|
-
export { registerChromePassthrough } from './chrome/internals.js';
|
|
4
|
-
export { invokeNative, isNativeParityAction, type NativeArgs, requireArgumentArray, resolveChromeMethod, } from './chrome/native.js';
|
|
5
|
-
export { executeMainThreadCommand } from './command.js';
|
|
6
|
-
export { buildSnapshotInTab, ensureDomSnapshot, handleDomFormat, handleDomSnapshot, } from './dom/snapshot.js';
|
|
7
|
-
export { handleFetch } from './fetch.js';
|
|
8
|
-
export { handleHostCallAction } from './host.js';
|
|
9
|
-
export { CONTENT_SCRIPT_GRACE_MS, CS_FAST_PING_MS, DEFAULT_MAX_NODES, DEFAULT_POLL_INTERVAL_MS, DEFAULT_SCROLL_AMOUNT, DEFAULT_TIMEOUT_MS, NAVIGATION_SETTLE_MS, NETWORK_IDLE_QUIET_MS, } from './lib/constants.js';
|
|
10
|
-
export { isValidMainThreadAction, registerHostHandler, registerHostHandlers, } from './lib/host-registry.js';
|
|
11
|
-
export { asRecord, extractTabId, normalizeParams, unwrapResult, } from './lib/params.js';
|
|
12
|
-
export type { DomFormatParams, DomSnapshotParams, FetchParams, } from './lib/types.js';
|
|
13
|
-
export { makeError, throwAgentError } from './lib/types.js';
|
|
14
|
-
export { extractRefId, getElementByRefId } from './sidepanel/dom.js';
|
|
15
|
-
export { pingTabContentScript, preflightDomTab, waitForTabLoad, } from './tab/execute.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Find an element by its opaque reference ID.
|
|
3
|
-
* @param refId — opaque element ref in 'e{N}' format (e.g. 'e2'). Must match schema regex ^e\d+$.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getElementByRefId(refId: string): Element | null;
|
|
6
|
-
export declare function extractRefId(params: unknown): string | undefined;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Command } from '../../shared/cross/manifest.js';
|
|
2
|
-
|
|
3
|
-
export declare function isSnapshotAction(action: string): boolean;
|
|
4
|
-
/**
|
|
5
|
-
* Collect snapshots from every http(s) frame in the tab, merge them,
|
|
6
|
-
* and return the unified result. Pipeline: enumerate → collect → merge.
|
|
7
|
-
*/
|
|
8
|
-
export declare function executeMultiFrameSnapshot(cmd: Command, tabId: number, relayId?: string): Promise<unknown>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AsyncResponse } from '../../../shared/main/tool-registry.js';
|
|
2
|
-
|
|
3
|
-
/** Fail fast when a tab URL cannot host content-script DOM APIs (non-http(s)). */
|
|
4
|
-
export declare function preflightDomTab(tabId: number): Promise<AsyncResponse | null>;
|
|
5
|
-
export declare function pingTabContentScript(tabId: number, timeoutMs?: number): Promise<AsyncResponse<{
|
|
6
|
-
ok: true;
|
|
7
|
-
}>>;
|
|
8
|
-
export type WaitForTabLoadOptions = {
|
|
9
|
-
/** Tab URL before navigation; used to detect blocked navigations, not for redirect matching. */
|
|
10
|
-
preNavigationUrl?: string;
|
|
11
|
-
/** When set, returns whether a loading event was observed before waitForTabLoad (e.g. listener registered pre-update). */
|
|
12
|
-
getNavSawLoading?: () => boolean;
|
|
13
|
-
/** trace-id for logging correlation with the originating run_js cell. */
|
|
14
|
-
runId?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Grace window (ms) for heavy SPAs whose `load` event never fires. Once the
|
|
17
|
-
* tab has provably navigated (URL moved away from preNavigationUrl) but
|
|
18
|
-
* `complete` hasn't arrived, settle as loaded after this delay instead of
|
|
19
|
-
* waiting out the full timeout. Default 5000. Ignored when preNavigationUrl
|
|
20
|
-
* is unknown (can't prove navigation).
|
|
21
|
-
*/
|
|
22
|
-
loadGraceMs?: number;
|
|
23
|
-
};
|
|
24
|
-
export declare function waitForTabLoad(tabId: number | null, timeoutMs?: number, options?: WaitForTabLoadOptions): Promise<AsyncResponse<boolean>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Initialize capability cache by reading chrome.permissions.getAll().
|
|
3
|
-
* Call once at extension startup.
|
|
4
|
-
*/
|
|
5
|
-
export declare function initCapabilities(): Promise<void>;
|
|
6
|
-
/** Re-read chrome.permissions.getAll() and update the cache. */
|
|
7
|
-
export declare function refreshCapabilities(): Promise<void>;
|
|
8
|
-
/** Reset the capability cache to null (test helper). */
|
|
9
|
-
export declare function resetCapabilities(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Manifest permission for a chrome API path, or null when no manifest permission is required.
|
|
12
|
-
*/
|
|
13
|
-
export declare function manifestPermissionForApiPath(apiPath: string[]): string | null;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Use manifestPermissionForApiPath
|
|
16
|
-
*/
|
|
17
|
-
export declare function permissionFromApiPath(apiPath: string[]): string | null;
|
|
18
|
-
/**
|
|
19
|
-
* Manifest permission for a chrome_* action target.
|
|
20
|
-
* e.g. "chrome_notifications_create" → "notifications"
|
|
21
|
-
*/
|
|
22
|
-
export declare function permissionFromChromeAction(action: string): string | null;
|
|
23
|
-
/**
|
|
24
|
-
* Whether a manifest permission is currently granted.
|
|
25
|
-
* - null permission → always true (namespace-only APIs)
|
|
26
|
-
* - non-null → cache-only; false when cache missing or permission absent
|
|
27
|
-
*/
|
|
28
|
-
export declare function hasPermission(permission: string | null): boolean;
|
|
29
|
-
/** Throw E_PERMISSION if the manifest permission is required but not granted. */
|
|
30
|
-
export declare function checkPermission(apiName: string, permission: string | null): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
export declare const zChromeAny: z.ZodUnknown;
|
|
4
|
-
/** Chrome void APIs often resolve to undefined, null, or boolean (not strictly null). */
|
|
5
|
-
export declare const zChromeVoid: z.ZodUnion<[z.ZodNull, z.ZodUndefined, z.ZodBoolean]>;
|
|
6
|
-
/** @deprecated Use zChromeVoid */
|
|
7
|
-
export declare const zChromeNull: z.ZodUnion<[z.ZodNull, z.ZodUndefined, z.ZodBoolean]>;
|
|
8
|
-
/** Register a chrome.* passthrough from action name and API path segments. */
|
|
9
|
-
export declare function regChrome(action: string, apiPath: string[], description: string, returnsSchema?: z.ZodSchema<unknown>, example?: string, returnType?: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|