@pi-oxide/extension-js 0.2.3 → 0.3.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.
package/generated.d.ts CHANGED
@@ -1,5 +1,48 @@
1
- import { TreeSnapshot } from '@pi-oxide/dom-semantic-tree';
2
-
1
+ export type TreeSnapshot = {
2
+ version: string;
3
+ url: string | null;
4
+ title: string | null;
5
+ viewport: {
6
+ width: number;
7
+ height: number;
8
+ scrollX: number;
9
+ scrollY: number;
10
+ } | null;
11
+ nodes: SemanticNode[];
12
+ outline?: OutlineNode[];
13
+ };
14
+ export type SemanticNode = {
15
+ refId: string;
16
+ role: string;
17
+ name?: string;
18
+ description?: string;
19
+ tag: string;
20
+ id?: string;
21
+ classes?: string[];
22
+ value?: string;
23
+ placeholder?: string;
24
+ href?: string;
25
+ states: Record<string, boolean | undefined>;
26
+ inputType?: string;
27
+ rect?: {
28
+ x: number;
29
+ y: number;
30
+ width: number;
31
+ height: number;
32
+ top: number;
33
+ right: number;
34
+ bottom: number;
35
+ left: number;
36
+ };
37
+ inViewport: boolean;
38
+ visible: boolean;
39
+ path?: string;
40
+ };
41
+ export type OutlineNode = {
42
+ role: string;
43
+ name: string;
44
+ ref_id: string;
45
+ };
3
46
  export type CommandParams = FetchParams | SleepParams | PageClickParams | PageDblClickParams | PageFillParams | PageTypeParams | PagePressParams | PageSelectParams | PageCheckParams | PageHoverParams | PageScrollParams | PageScrollToParams | PageGotoParams | PageFindParams | PageWaitForParams | PageExtractParams | PageAppendParams | PageWaitParams | StorageGetParams | StorageSetParams | StorageDeleteParams | DomSnapshotParams | DomFormatParams | TabClickParams | TabFillParams | TabEvaluateParams | TabBackParams | TabWaitForLoadParams | TabScrollToParams | TabTypeParams | TabPressParams | TabSelectParams | TabCheckParams | TabHoverParams | TabUnhoverParams | TabScrollParams | TabDblClickParams | FsWriteParams | FsPathParams | FsCopyParams | FsUpdateParams | FsHashParams | FsReadRangeParams;
4
47
  export type AsyncCommand = {
5
48
  call_id: number;
package/index.d.ts CHANGED
@@ -1,92 +1,6 @@
1
- import { CellResult, FsCopyParams, FsHashParams, FsPathParams, FsReadRangeDataParams, FsReadRangeParams, FsWriteParams, WasmGlobalsSnapshot } from './extension_js.js';
2
- import { registerHostHandler, registerHostHandlers } from './runner.js';
3
-
4
- export { generateApiDocs } from './extension_js.js';
5
- export type { LogLevel } from './logger.js';
6
- export { setLogLevel } from './logger.js';
7
- export type { CellResult as JsRunResult, WasmGlobalsSnapshot as JsGlobalsSnapshot, };
8
- export { registerHostHandler, registerHostHandlers };
9
- export interface JsApiDoc {
10
- namespace: string;
11
- name: string;
12
- action: string | null;
13
- description: string;
14
- params: {
15
- name: string;
16
- js_type: string;
17
- required: boolean;
18
- description: string;
19
- }[];
20
- returns: {
21
- js_type: string;
22
- description: string;
23
- };
24
- source: string;
25
- }
26
- /**
27
- * ExtensionSession proxy that lives on the main thread.
28
- * The actual WASM ExtensionSession runs inside a Web Worker;
29
- * this proxy forwards calls via postMessage and awaits responses.
30
- */
31
- export declare class ExtensionSession {
32
- private worker;
33
- private pendingCalls;
34
- private disposed;
35
- private onCleanupComplete;
36
- private abortController;
37
- private constructor();
38
- /**
39
- * Initialize the extension-js runtime.
40
- * Automatically detects extension context, spawns the Worker,
41
- * starts the main-thread runner loop, and returns [session, runner].
42
- *
43
- * The spawned Worker uses `new Worker(..., { type: "module" })`. Your bundler
44
- * must support emitting module Workers as separate chunks.
45
- *
46
- * AbortController is module-global: only one active session per extension
47
- * page is fully safe. Concurrent sessions race on the same abort signal.
48
- */
49
- static init(): Promise<[ExtensionSession, Promise<void>]>;
50
- private startWorker;
51
- private handleWorkerMessage;
52
- private postAndWait;
53
- runCellAsync(code: string, stdin?: string): Promise<CellResult>;
54
- reset(): Promise<void>;
55
- inspectGlobals(): Promise<WasmGlobalsSnapshot>;
56
- setFuelLimit(limit: number): void;
57
- loadLibrary(source: string): Promise<CellResult>;
58
- private safePost;
59
- get fs(): {
60
- exists: (params: FsPathParams) => Promise<import('./extension_js.js').FsExistsResult>;
61
- stat: (params: FsPathParams) => Promise<import('./extension_js.js').FsStatResult>;
62
- read: (params: FsPathParams) => Promise<import('./extension_js.js').FsStringResult>;
63
- readText: (params: FsPathParams) => Promise<import('./extension_js.js').FsStringResult>;
64
- readBase64: (params: FsPathParams) => Promise<import('./extension_js.js').FsStringResult>;
65
- list: (params: FsPathParams) => Promise<import('./extension_js.js').FsListResult>;
66
- mkdir: (params: FsPathParams) => Promise<import('./extension_js.js').FsBoolResult>;
67
- delete: (params: FsPathParams) => Promise<import('./extension_js.js').FsBoolResult>;
68
- copy: (params: FsCopyParams) => Promise<import('./extension_js.js').FsBoolResult>;
69
- move: (params: FsCopyParams) => Promise<import('./extension_js.js').FsBoolResult>;
70
- write: (params: FsWriteParams) => Promise<import('./extension_js.js').FsBoolResult>;
71
- writeText: (params: FsWriteParams) => Promise<import('./extension_js.js').FsBoolResult>;
72
- writeBase64: (params: FsWriteParams) => Promise<import('./extension_js.js').FsBoolResult>;
73
- append: (params: FsWriteParams) => Promise<import('./extension_js.js').FsBoolResult>;
74
- appendText: (params: FsWriteParams) => Promise<import('./extension_js.js').FsBoolResult>;
75
- appendBase64: (params: FsWriteParams) => Promise<import('./extension_js.js').FsBoolResult>;
76
- readRange: (params: FsReadRangeParams) => Promise<import('./extension_js.js').FsStringResult>;
77
- update: (params: FsReadRangeDataParams) => Promise<import('./extension_js.js').FsBoolResult>;
78
- hash: (params: FsHashParams) => Promise<import('./extension_js.js').FsHashResult>;
79
- };
80
- /**
81
- * Clean up the session, terminate the Worker, and release resources.
82
- * Accepts the runner Promise returned by init() so it can be awaited
83
- * for graceful shutdown.
84
- *
85
- * Sends a reset message to the Worker, then waits only 50 ms before
86
- * forcefully calling worker.terminate(). If WASM cleanup takes longer,
87
- * the Worker is killed mid-operation. Pending async calls are rejected
88
- * with "ExtensionSession stopped".
89
- */
90
- stopWith(runner: Promise<void>): Promise<void>;
91
- private generateId;
1
+ export {};
2
+ declare global {
3
+ interface Window {
4
+ __jsNotebookContentScriptInjected?: boolean;
5
+ }
92
6
  }