@mind-harness/mh-browser 0.2.4 → 0.2.5
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/extension/manifest.json +1 -1
- package/lib/client.cjs +1 -1
- package/lib/index.js +495 -267
- package/lib/typert.host.js +1 -1
- package/lib/typert.remote-client.js +1 -1
- package/lib/types/service/abortable.d.ts +24 -0
- package/lib/types/service/extension.d.ts +7 -6
- package/lib/types/service/windows.d.ts +10 -3
- package/lib/types/tools/given.d.ts +5 -0
- package/package.json +1 -1
package/lib/typert.host.js
CHANGED
|
@@ -44,7 +44,7 @@ const $remote = createTypertRemoteInfo({
|
|
|
44
44
|
create: _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema,
|
|
45
45
|
jsonSchema: {"type":"object","properties":{"status":{"type":"string","enum":["revealed","not-handing-over","no-tab"]}},"required":["status"],"additionalProperties":true},
|
|
46
46
|
},
|
|
47
|
-
sourceLocation: {"file":"packages/mh-browser/src/service/service.ts","line":
|
|
47
|
+
sourceLocation: {"file":"packages/mh-browser/src/service/service.ts","line":684,"column":9},
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
}, z)
|
|
@@ -44,7 +44,7 @@ export const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
|
44
44
|
create: _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema,
|
|
45
45
|
jsonSchema: {"type":"object","properties":{"status":{"type":"string","enum":["revealed","not-handing-over","no-tab"]}},"required":["status"],"additionalProperties":true},
|
|
46
46
|
},
|
|
47
|
-
sourceLocation: {"file":"packages/mh-browser/src/service/service.ts","line":
|
|
47
|
+
sourceLocation: {"file":"packages/mh-browser/src/service/service.ts","line":684,"column":9},
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
}, z)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MhBrowserError } from '../types.ts';
|
|
2
|
+
/** A wait ended because its signal aborted, including a deadline synthesized here. */
|
|
3
|
+
export declare function stopped(): MhBrowserError;
|
|
4
|
+
export declare function isInterrupted(error: unknown): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* `promise`, or a rejection when `signal` aborts. The original promise is
|
|
7
|
+
* always observed, so abandoning it leaves no unhandled rejection.
|
|
8
|
+
*/
|
|
9
|
+
export declare function untilAborted<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
10
|
+
/** `signal`, a deadline of `ms`, or whichever of the two aborts first. */
|
|
11
|
+
export declare function capped(signal: AbortSignal | undefined, ms: number): AbortSignal;
|
|
12
|
+
export interface Queued<T> {
|
|
13
|
+
/** Rejects as soon as `signal` aborts, including while `previous` is still running. */
|
|
14
|
+
run: Promise<T>;
|
|
15
|
+
/** Settles after `previous`, and after `op` when `op` started. Never rejects. */
|
|
16
|
+
tail: Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Run `op` once `previous` settles. Aborting `signal` while waiting rejects
|
|
20
|
+
* `run` and does not call `op`. `tail` still follows `previous`, and `op`
|
|
21
|
+
* when `op` has started, so a later caller cannot overlap the work.
|
|
22
|
+
*/
|
|
23
|
+
export declare function enqueue<T>(previous: Promise<unknown>, op: () => Promise<T>, signal?: AbortSignal): Queued<T>;
|
|
24
|
+
//# sourceMappingURL=abortable.d.ts.map
|
|
@@ -17,16 +17,17 @@ export declare class Extension {
|
|
|
17
17
|
/** Address of a page shipped in the extension directory. */
|
|
18
18
|
pageUrl(name: string): string;
|
|
19
19
|
/** `chrome.tabs.create` in the named window. Returns the extension's tab id. */
|
|
20
|
-
createTab(windowId: number, url: string): Promise<number>;
|
|
21
|
-
tabIdsIn(windowId: number): Promise<number[]>;
|
|
22
|
-
activate(tabId: number): Promise<void>;
|
|
20
|
+
createTab(windowId: number, url: string, signal?: AbortSignal): Promise<number>;
|
|
21
|
+
tabIdsIn(windowId: number, signal?: AbortSignal): Promise<number[]>;
|
|
22
|
+
activate(tabId: number, signal?: AbortSignal): Promise<void>;
|
|
23
23
|
group(tabId: number, target: {
|
|
24
24
|
groupId: number;
|
|
25
25
|
} | {
|
|
26
26
|
windowId: number;
|
|
27
|
-
}): Promise<number>;
|
|
28
|
-
styleGroup(groupId: number, title: string, color: 'blue' | 'red'): Promise<void>;
|
|
29
|
-
ungroup(tabId: number): Promise<void>;
|
|
27
|
+
}, signal?: AbortSignal): Promise<number>;
|
|
28
|
+
styleGroup(groupId: number, title: string, color: 'blue' | 'red', signal?: AbortSignal): Promise<void>;
|
|
29
|
+
ungroup(tabId: number, signal?: AbortSignal): Promise<void>;
|
|
30
|
+
private answer;
|
|
30
31
|
private worker;
|
|
31
32
|
}
|
|
32
33
|
/** The extension's service worker. Looks once more after the wait times out. */
|
|
@@ -114,7 +114,7 @@ export declare class Windows {
|
|
|
114
114
|
/** The tab touched most recently, for raising the window the person asked to see. */
|
|
115
115
|
latest(owner: OwnerId): LiveTab | undefined;
|
|
116
116
|
/** Make this tab the current one in its window. Does not raise the browser. */
|
|
117
|
-
activate(tab: LiveTab): Promise<void>;
|
|
117
|
+
activate(tab: LiveTab, signal?: AbortSignal): Promise<void>;
|
|
118
118
|
/** Group title for the person. Empty until a title is known. */
|
|
119
119
|
setTitle(owner: OwnerId, title: string): void;
|
|
120
120
|
/** A handover in progress prefixes the group title and recolors it. */
|
|
@@ -126,15 +126,17 @@ export declare class Windows {
|
|
|
126
126
|
* use the extension. Without a window, later pages use `window.open` from
|
|
127
127
|
* an isolated world so they stay in that window.
|
|
128
128
|
*/
|
|
129
|
-
openBlank(owner: OwnerId): Promise<LiveTab>;
|
|
129
|
+
openBlank(owner: OwnerId, signal?: AbortSignal): Promise<LiveTab>;
|
|
130
130
|
private createTab;
|
|
131
131
|
private keep;
|
|
132
|
+
/** The page from a create, or close it when this wait is abandoned. */
|
|
133
|
+
private claimedPage;
|
|
132
134
|
/**
|
|
133
135
|
* Close one tab. `note` is listed in the next `<tabs>` block. A tab the
|
|
134
136
|
* model was never shown (an Agent View discovered on a new tab) omits it.
|
|
135
137
|
*/
|
|
136
138
|
closeTab(tab: LiveTab, note?: string): Promise<void>;
|
|
137
|
-
closeOwner(owner: OwnerId): Promise<void>;
|
|
139
|
+
closeOwner(owner: OwnerId, signal?: AbortSignal): Promise<void>;
|
|
138
140
|
private closePage;
|
|
139
141
|
/** A tab leaves the registry. The window closes with its last tab. */
|
|
140
142
|
private forget;
|
|
@@ -176,5 +178,10 @@ export declare class Windows {
|
|
|
176
178
|
private dropSession;
|
|
177
179
|
private targetIdOf;
|
|
178
180
|
private windowIdOf;
|
|
181
|
+
private pageSession;
|
|
182
|
+
private cdp;
|
|
183
|
+
/** Close a page that may no longer answer. A stall ends at `CLOSE_MS`. */
|
|
184
|
+
private shutdown;
|
|
185
|
+
private shutdownSession;
|
|
179
186
|
}
|
|
180
187
|
//# sourceMappingURL=windows.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** A string the caller gave. Blank is the same as omitting it; the text itself is kept. */
|
|
2
|
+
export declare function givenString(value: unknown): string | undefined;
|
|
3
|
+
/** Seconds to wait. Zero is the same as omitting it; any other number is kept. */
|
|
4
|
+
export declare function givenTime(value: unknown): number | undefined;
|
|
5
|
+
//# sourceMappingURL=given.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mind-harness/mh-browser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Opens pages in a real browser for the agent, keeps chosen Agent Views in context, and hands the browser to you when a person is needed.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"files": [
|