@mind-harness/mh-browser 0.0.0-stage → 0.1.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/LICENSE +57 -0
- package/README.md +4 -2
- package/extension/manifest.json +7 -0
- package/extension/sw.js +1 -0
- package/icon.svg +5 -0
- package/lib/index.js +6164 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +356 -0
- package/lib/typert.remote-client.d.ts +24 -0
- package/lib/typert.remote-client.js +52 -0
- package/lib/types/config.d.ts +12 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/types/presence/book.d.ts +36 -0
- package/lib/types/presence/fold.d.ts +49 -0
- package/lib/types/presence/notice.d.ts +8 -0
- package/lib/types/presence/plan.d.ts +47 -0
- package/lib/types/presence/record.d.ts +47 -0
- package/lib/types/presence/register.d.ts +21 -0
- package/lib/types/presence/source.d.ts +18 -0
- package/lib/types/projections.d.ts +25 -0
- package/lib/types/render/envelope.d.ts +80 -0
- package/lib/types/representation/agent-view.d.ts +61 -0
- package/lib/types/representation/agent-view.js +279 -0
- package/lib/types/representation/discovery.d.ts +23 -0
- package/lib/types/representation/read.d.ts +45 -0
- package/lib/types/service/actions.d.ts +7 -0
- package/lib/types/service/browser.d.ts +16 -0
- package/lib/types/service/control.d.ts +49 -0
- package/lib/types/service/extension.d.ts +30 -0
- package/lib/types/service/files.d.ts +17 -0
- package/lib/types/service/invoke.d.ts +31 -0
- package/lib/types/service/service.d.ts +183 -0
- package/lib/types/service/test-hooks.d.ts +7 -0
- package/lib/types/service/waits.d.ts +40 -0
- package/lib/types/service/windows.d.ts +174 -0
- package/lib/types/tools/act.d.ts +4 -0
- package/lib/types/tools/attachments.d.ts +23 -0
- package/lib/types/tools/delivery.d.ts +65 -0
- package/lib/types/tools/download.d.ts +4 -0
- package/lib/types/tools/handover.d.ts +4 -0
- package/lib/types/tools/invoke.d.ts +4 -0
- package/lib/types/tools/open.d.ts +4 -0
- package/lib/types/tools/paths.d.ts +3 -0
- package/lib/types/tools/presence.d.ts +4 -0
- package/lib/types/tools/register.d.ts +3 -0
- package/lib/types/tools/session.d.ts +32 -0
- package/lib/types/tools/tab-log.d.ts +18 -0
- package/lib/types/types.d.ts +169 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +76 -3
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/* Generated by @deepseek-ai/dsh-typert-generator from FaceModel — do not edit. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { createTypertRemoteInfo } from '@deepseek-ai/dsh-typert-protocol/remote-info'
|
|
5
|
+
|
|
6
|
+
let _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema$value
|
|
7
|
+
const _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema = () => (_mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema$value ??= z.string())
|
|
8
|
+
let _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema$value
|
|
9
|
+
const _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema = () => (_mind_harness_mh_browser_mhBrowser_revealHandover_result$schema$value ??= z.object({
|
|
10
|
+
'status': z.union([z.literal("revealed"), z.literal("not-handing-over"), z.literal("no-tab")]),
|
|
11
|
+
}))
|
|
12
|
+
let _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema$value
|
|
13
|
+
const _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema = () => (_mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema$value ??= z.string())
|
|
14
|
+
|
|
15
|
+
const $remote = createTypertRemoteInfo({
|
|
16
|
+
package: '@mind-harness/mh-browser',
|
|
17
|
+
methods: {
|
|
18
|
+
'mhBrowser/revealHandover': {
|
|
19
|
+
service: 'mhBrowser',
|
|
20
|
+
description: 'The person asked to see the page this Session handed over.',
|
|
21
|
+
invocation: { kind: 'direct' },
|
|
22
|
+
parameters: [
|
|
23
|
+
{
|
|
24
|
+
name: 'sessionId',
|
|
25
|
+
source: 'json',
|
|
26
|
+
codec: {
|
|
27
|
+
mode: 'strict',
|
|
28
|
+
typeSymbol: '@mind-harness/mh-browser#mhBrowser/revealHandover:sessionId',
|
|
29
|
+
create: _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema,
|
|
30
|
+
jsonSchema: {"type":"string"},
|
|
31
|
+
},
|
|
32
|
+
strictCodec: {
|
|
33
|
+
mode: 'strict',
|
|
34
|
+
typeSymbol: '@mind-harness/mh-browser#mhBrowser/revealHandover:sessionId',
|
|
35
|
+
create: _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema,
|
|
36
|
+
jsonSchema: {"type":"string"},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
cancellation: { parameter: 'signal' },
|
|
41
|
+
result: {
|
|
42
|
+
mode: 'strict',
|
|
43
|
+
typeSymbol: '@mind-harness/mh-browser#mhBrowser/revealHandover:result',
|
|
44
|
+
create: _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema,
|
|
45
|
+
jsonSchema: {"type":"object","properties":{"status":{"type":"string","enum":["revealed","not-handing-over","no-tab"]}},"required":["status"],"additionalProperties":true},
|
|
46
|
+
},
|
|
47
|
+
sourceLocation: {"file":"packages/mh-browser/src/service/service.ts","line":571,"column":9},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}, z)
|
|
51
|
+
|
|
52
|
+
export const TYPERT = {
|
|
53
|
+
package: '@mind-harness/mh-browser',
|
|
54
|
+
face: 'host',
|
|
55
|
+
schemas: [
|
|
56
|
+
],
|
|
57
|
+
get invocations() { return $remote.descriptors },
|
|
58
|
+
model: {
|
|
59
|
+
"services": [
|
|
60
|
+
{
|
|
61
|
+
"description": "Browser service. Launch, windows, tabs, waits, the request channel, and the current representation of each tab. Declared actions and downloads go through the request channel. Person input outside a service dispatch takes the session's browser. `act` returns a snapshot, including on a page that also has an Agent View.",
|
|
62
|
+
"summary": "Browser service.",
|
|
63
|
+
"tags": [],
|
|
64
|
+
"jsDoc": "/**\n * Browser service. Launch, windows, tabs, waits, the request channel, and\n * the current representation of each tab. Declared actions and downloads go\n * through the request channel. Person input outside a service dispatch takes\n * the session's browser. `act` returns a snapshot, including on a page that\n * also has an Agent View.\n */",
|
|
65
|
+
"key": "mhBrowser",
|
|
66
|
+
"exportName": "MhBrowserService",
|
|
67
|
+
"members": [
|
|
68
|
+
{
|
|
69
|
+
"kind": "method",
|
|
70
|
+
"name": "open",
|
|
71
|
+
"signature": "async open( owner: string, items: { url: string; waitFor?: WaitFor }[], signal?: AbortSignal, ): Promise<(PageView | PageError)[]>"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"kind": "method",
|
|
75
|
+
"name": "view",
|
|
76
|
+
"signature": "async view(owner: string, tab: string, signal?: AbortSignal): Promise<PageView | PageError>"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"kind": "method",
|
|
80
|
+
"name": "rememberPresence",
|
|
81
|
+
"signature": "rememberPresence(owner: string, urls: string[]): void",
|
|
82
|
+
"summary": "Pages whose current representation is already in the model's presence.",
|
|
83
|
+
"jsDoc": "/** Pages whose current representation is already in the model's presence. */"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"kind": "method",
|
|
87
|
+
"name": "presenceList",
|
|
88
|
+
"signature": "presenceList(owner: string): HeldPage[]"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"kind": "method",
|
|
92
|
+
"name": "presencePut",
|
|
93
|
+
"signature": "presencePut(owner: string, urls: string[], source: PresenceSource): PresenceReceipt[]"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"kind": "method",
|
|
97
|
+
"name": "presenceRemove",
|
|
98
|
+
"signature": "presenceRemove(owner: string, urls: string[]): PresenceReceipt[]"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"kind": "method",
|
|
102
|
+
"name": "presenceLoad",
|
|
103
|
+
"signature": "presenceLoad( owner: string, folded: { pages: readonly HeldPage[]; removals: readonly PendingOp[] }, ): void",
|
|
104
|
+
"summary": "The set the session log folds to; taken once per process.",
|
|
105
|
+
"jsDoc": "/** The set the session log folds to; taken once per process. */"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"kind": "method",
|
|
109
|
+
"name": "presenceTakeResume",
|
|
110
|
+
"signature": "presenceTakeResume(owner: string): boolean"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"kind": "method",
|
|
114
|
+
"name": "presenceCheck",
|
|
115
|
+
"signature": "async presenceCheck( owner: string, which: readonly string[] | 'all', opts?: { baseline?: boolean; replaces?: boolean; force?: boolean; signal?: AbortSignal }, ): Promise<{ text: string; record: PresenceRecord } | undefined>",
|
|
116
|
+
"summary": "Re-read presence pages and build the next reminder.",
|
|
117
|
+
"jsDoc": "/**\n * Re-read presence pages and build the next reminder.\n * A tab already on the address is read in place. A check that has to open\n * one closes it before returning. Removals are included, and they cause\n * every remaining page to be read so a page kept out by the byte budget\n * can come back. An empty set has nothing to read and does not wait for the\n * browser; a browser that is down makes every page absent.\n */"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"kind": "method",
|
|
121
|
+
"name": "noteWorkspace",
|
|
122
|
+
"signature": "noteWorkspace(owner: string, target: WriteTarget): void",
|
|
123
|
+
"summary": "Where a download the page starts may be written: the session's writable root, or why it may not write at all.",
|
|
124
|
+
"jsDoc": "/**\n * Where a download the page starts may be written: the session's writable\n * root, or why it may not write at all.\n */"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"kind": "method",
|
|
128
|
+
"name": "tabs",
|
|
129
|
+
"signature": "tabs(owner: string): TabInfo[]"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"kind": "method",
|
|
133
|
+
"name": "takeClosed",
|
|
134
|
+
"signature": "takeClosed(owner: string): string[]"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"kind": "method",
|
|
138
|
+
"name": "windowId",
|
|
139
|
+
"signature": "windowId(owner: string, tab: string): Promise<number | undefined>"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"kind": "method",
|
|
143
|
+
"name": "fetch",
|
|
144
|
+
"signature": "async fetch( url: string, opts?: { accept?: string; ifNoneMatch?: string }, ): Promise<FetchResponseBody | { kind: 'error'; reason: string }>"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"kind": "method",
|
|
148
|
+
"name": "pushPath",
|
|
149
|
+
"signature": "async pushPath(owner: string, tab: string, path: string): Promise<void>"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"kind": "method",
|
|
153
|
+
"name": "started",
|
|
154
|
+
"signature": "async started(): Promise<void>"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"kind": "method",
|
|
158
|
+
"name": "[testHooks]",
|
|
159
|
+
"signature": "[testHooks](): TestHooks"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"kind": "method",
|
|
163
|
+
"name": "act",
|
|
164
|
+
"signature": "async act( owner: string, tab: string, action: ActAction, signal?: AbortSignal, ): Promise<PageView>"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"kind": "method",
|
|
168
|
+
"name": "holdHandover",
|
|
169
|
+
"signature": "holdHandover(owner: string, tab: string): void"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"kind": "method",
|
|
173
|
+
"name": "releaseHandover",
|
|
174
|
+
"signature": "releaseHandover(owner: string): void"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"kind": "method",
|
|
178
|
+
"name": "capture",
|
|
179
|
+
"signature": "capture(owner: string, tab: string, signal?: AbortSignal): Promise<Uint8Array | undefined>",
|
|
180
|
+
"summary": "`undefined` when no screenshot can be taken now: a dialog is open, or the page refused.",
|
|
181
|
+
"jsDoc": "/** `undefined` when no screenshot can be taken now: a dialog is open, or the page refused. */"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"kind": "method",
|
|
185
|
+
"name": "invoke",
|
|
186
|
+
"signature": "invoke( owner: string, page: string, call: InvokeCall, opts?: { signal?: AbortSignal; readFile?: (value: unknown) => Promise<string> }, ): Promise<InvokeSent>"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"kind": "method",
|
|
190
|
+
"name": "download",
|
|
191
|
+
"signature": "async download( owner: string, url: string, root: string, signal?: AbortSignal, ): Promise<Download>",
|
|
192
|
+
"summary": "Not queued: it opens no tab, and a long body must not hold up the Session's other calls.",
|
|
193
|
+
"jsDoc": "/**\n * Not queued: it opens no tab, and a long body must not hold up the\n * Session's other calls. `root` is the directory the session may write.\n */"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"kind": "method",
|
|
197
|
+
"name": "controlOf",
|
|
198
|
+
"signature": "controlOf(owner: string): 'model' | 'person'"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"kind": "method",
|
|
202
|
+
"name": "bindPersonTouch",
|
|
203
|
+
"signature": "bindPersonTouch(fn: (owner: string, urls: string[]) => void): () => void",
|
|
204
|
+
"summary": "Presence registers this.",
|
|
205
|
+
"jsDoc": "/** Presence registers this. A hand-back calls it with the touched presence pages. */"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"kind": "method",
|
|
209
|
+
"name": "handover",
|
|
210
|
+
"signature": "handover( owner: string, req: { tab?: string; reason: string }, signal?: AbortSignal, ): Promise<void>",
|
|
211
|
+
"summary": "Give the browser to the person.",
|
|
212
|
+
"jsDoc": "/**\n * Give the browser to the person. The named tab stays in use until hand-back.\n * This does not wait; the tool waits on the question card.\n */"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"kind": "method",
|
|
216
|
+
"name": "noteSessionTitle",
|
|
217
|
+
"signature": "noteSessionTitle(owner: string, title: string): void",
|
|
218
|
+
"summary": "Remember the Session title for its tab group.",
|
|
219
|
+
"jsDoc": "/** Remember the Session title for its tab group. Empty when the host has none. */"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"kind": "method",
|
|
223
|
+
"name": "bringToFront",
|
|
224
|
+
"signature": "async bringToFront(owner: string): Promise<boolean>",
|
|
225
|
+
"summary": "Raise the window of this owner's latest tab.",
|
|
226
|
+
"jsDoc": "/** Raise the window of this owner's latest tab. False when it has no tab. */"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"kind": "method",
|
|
230
|
+
"name": "revealHandover",
|
|
231
|
+
"signature": "@Remote async revealHandover( sessionId: string, signal?: AbortSignal, ): Promise<{ status: 'revealed' | 'not-handing-over' | 'no-tab' }>",
|
|
232
|
+
"summary": "The person asked to see the page this Session handed over.",
|
|
233
|
+
"jsDoc": "/** The person asked to see the page this Session handed over. */"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"kind": "method",
|
|
237
|
+
"name": "handBack",
|
|
238
|
+
"signature": "async handBack(owner: string, note?: string): Promise<HandBack>",
|
|
239
|
+
"summary": "The person answered.",
|
|
240
|
+
"jsDoc": "/** The person answered. Returns the note, the operation count, and the named tab. */"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"kind": "method",
|
|
244
|
+
"name": "releaseIfHeld",
|
|
245
|
+
"signature": "releaseIfHeld(owner: string): void",
|
|
246
|
+
"summary": "A stopped handover gives control back.",
|
|
247
|
+
"jsDoc": "/** A stopped handover gives control back. A finished hand-back is left alone. */"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"kind": "method",
|
|
251
|
+
"name": "takePersonHandback",
|
|
252
|
+
"signature": "takePersonHandback(owner: string): HandBack | undefined",
|
|
253
|
+
"summary": "The person took over between turns.",
|
|
254
|
+
"jsDoc": "/**\n * The person took over between turns. The next message they send is the\n * hand-back. A handover that is still waiting on its card is not.\n */"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"types": [
|
|
258
|
+
{
|
|
259
|
+
"name": "ActAction",
|
|
260
|
+
"declaration": "export type ActAction = { kind: 'click'; ref: string; double?: boolean; button?: 'left' | 'right' | 'middle'; modifiers?: Array<'Alt' | 'Control' | 'Meta' | 'Shift'>; } | { kind: 'select'; ref: string; values: string[]; } | { kind: 'press'; key: string; ref?: string; } | { kind: 'fill'; fields: { ref: string; value: string; }[]; } | { kind: 'upload'; ref: string; files: string[]; } | { kind: 'dialog'; accept: boolean; promptText?: string; } | { kind: 'back'; } | { kind: 'wait'; text?: string; textGone?: string; time?: number; } | { kind: 'look'; };"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "ActionResponse",
|
|
264
|
+
"declaration": "export interface ActionResponse {\n name: string;\n status?: number;\n location?: string;\n mediaType?: string;\n body?: string;\n bytes?: number;\n lost?: boolean;\n}"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "Dialog",
|
|
268
|
+
"declaration": "export interface Dialog {\n type: string;\n message: string;\n}"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"name": "Download",
|
|
272
|
+
"declaration": "export type Download = { kind: 'saved'; path: string; url: string; mediaType?: string; bytes: number; sha256: string; observed: string; } | { kind: 'error'; url: string; status?: number; reason: string; };"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"name": "FetchResponseBody",
|
|
276
|
+
"declaration": "export interface FetchResponseBody {\n kind: 'response';\n finalUrl: string;\n status: number;\n mediaType?: string;\n etag?: string;\n link?: string;\n body: Uint8Array;\n}"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "HandBack",
|
|
280
|
+
"declaration": "export interface HandBack extends Taken {\n urls: string[];\n note?: string;\n page?: PageView;\n}"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "HeldPage",
|
|
284
|
+
"declaration": "export interface HeldPage {\n url: string;\n source: PresenceSource;\n state: 'committed' | 'pending';\n order: number;\n seen?: { version?: string; digest: string; observedAt: string; id?: string; } | { absent: string; };\n title?: string;\n representation?: 'agent-view' | 'snapshot';\n body?: string;\n agentViewError?: string;\n fragment?: string;\n requires?: string[];\n viewUrl?: string;\n}"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"name": "InvokeCall",
|
|
288
|
+
"declaration": "export interface InvokeCall {\n name: string;\n item?: string;\n input?: Record<string, unknown>;\n seen: { digest: string; } | 'not-in-context';\n}"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "InvokeSent",
|
|
292
|
+
"declaration": "export interface InvokeSent {\n schemaRejected: boolean;\n response?: ActionResponse;\n page: PageView | PageError;\n}"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "PageError",
|
|
296
|
+
"declaration": "export interface PageError {\n tab?: TabId;\n url: string;\n reason: string;\n}"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"name": "PageView",
|
|
300
|
+
"declaration": "export interface PageView {\n tab: TabId;\n url: string;\n title: string;\n observedAt: string;\n representation: { kind: 'agent-view'; text: string; version?: string; href?: string; } | { kind: 'snapshot'; text: string; agentViewError?: string; agentView?: { version?: string; }; };\n fragment?: string;\n status?: number;\n mediaType?: string;\n body?: string;\n inPresence: boolean;\n dialog?: Dialog;\n incomplete?: { load: boolean; pendingRequests: number; };\n waited?: { met: 'text' | 'textGone' | 'time' | false; seconds: number; };\n download?: Download;\n}"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "PendingOp",
|
|
304
|
+
"declaration": "export interface PendingOp {\n op: 'put' | 'remove';\n url: string;\n}"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "PresenceEntryRecord",
|
|
308
|
+
"declaration": "export interface PresenceEntryRecord {\n op: PresenceOp;\n url: string;\n source: PresenceSource;\n version?: string;\n observedAt: string;\n digest: string;\n id?: string;\n reason?: string;\n}"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"name": "PresenceOp",
|
|
312
|
+
"declaration": "export type PresenceOp = 'present' | 'added' | 'changed' | 'absent' | 'removed';"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"name": "PresenceReceipt",
|
|
316
|
+
"declaration": "export interface PresenceReceipt {\n url: string;\n receipt: 'added (pending)' | 'already in presence' | 'removed (pending)' | 'not in presence';\n}"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"name": "PresenceRecord",
|
|
320
|
+
"declaration": "export interface PresenceRecord {\n kind: 'baseline' | 'delta';\n replaces?: true;\n entries: PresenceEntryRecord[];\n}"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "PresenceSource",
|
|
324
|
+
"declaration": "export type PresenceSource = (typeof PRESENCE_SOURCES)[number];"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"name": "TabId",
|
|
328
|
+
"declaration": "export type TabId = string;"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"name": "TabInfo",
|
|
332
|
+
"declaration": "export interface TabInfo {\n tab: TabId;\n url: string;\n title: string;\n occupied: boolean;\n inPresence: boolean;\n mayHaveChanged: boolean;\n}"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "Taken",
|
|
336
|
+
"declaration": "export interface Taken {\n operations: number;\n tabs: string[];\n from: string;\n to: string;\n tab?: string;\n}"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "TestHooks",
|
|
340
|
+
"declaration": "export interface TestHooks {\n crash(): Promise<void>;\n page(owner: string, tab: string): unknown;\n}"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "WaitFor",
|
|
344
|
+
"declaration": "export interface WaitFor {\n text?: string;\n textGone?: string;\n time?: number;\n}"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "WriteTarget",
|
|
348
|
+
"declaration": "export type WriteTarget = { root: string; } | { denied: string; code: 'SANDBOX_DENIED' | 'NO_WORKSPACE'; };"
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
"events": [],
|
|
354
|
+
"objects": []
|
|
355
|
+
},
|
|
356
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
|
|
2
|
+
import type {
|
|
3
|
+
RemoteResult,
|
|
4
|
+
TypertRemoteInfo,
|
|
5
|
+
TypertRemoteMethod,
|
|
6
|
+
} from '@deepseek-ai/dsh-typert-protocol'
|
|
7
|
+
|
|
8
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
9
|
+
interface TypertRemoteNamespace$6d6842726f77736572 {
|
|
10
|
+
revealHandover: (sessionId: string, signal?: AbortSignal) => Promise<RemoteResult<{ status: 'revealed' | 'not-handing-over' | 'no-tab'; }>>
|
|
11
|
+
}
|
|
12
|
+
interface TypertRemoteMap {
|
|
13
|
+
'mhBrowser/revealHandover': (sessionId: string, signal?: AbortSignal) => Promise<RemoteResult<{ status: 'revealed' | 'not-handing-over' | 'no-tab'; }>>
|
|
14
|
+
}
|
|
15
|
+
interface TypertRemoteNamespaceMap {
|
|
16
|
+
'mhBrowser': TypertRemoteNamespace$6d6842726f77736572
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare const TYPERT_REMOTE: TypertRemoteInfo<{
|
|
21
|
+
readonly 'mhBrowser/revealHandover': TypertRemoteMethod<{ readonly 'sessionId': string }, { status: 'revealed' | 'not-handing-over' | 'no-tab'; }>
|
|
22
|
+
}>
|
|
23
|
+
export default TYPERT_REMOTE
|
|
24
|
+
//# sourceMappingURL=typert.remote-client.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { createTypertRemoteInfo } from '@deepseek-ai/dsh-typert-protocol/remote-info'
|
|
5
|
+
|
|
6
|
+
let _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema$value
|
|
7
|
+
const _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema = () => (_mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema$value ??= z.string())
|
|
8
|
+
let _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema$value
|
|
9
|
+
const _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema = () => (_mind_harness_mh_browser_mhBrowser_revealHandover_result$schema$value ??= z.object({
|
|
10
|
+
'status': z.union([z.literal("revealed"), z.literal("not-handing-over"), z.literal("no-tab")]),
|
|
11
|
+
}))
|
|
12
|
+
let _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema$value
|
|
13
|
+
const _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema = () => (_mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema$value ??= z.string())
|
|
14
|
+
|
|
15
|
+
export const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
16
|
+
package: '@mind-harness/mh-browser',
|
|
17
|
+
methods: {
|
|
18
|
+
'mhBrowser/revealHandover': {
|
|
19
|
+
service: 'mhBrowser',
|
|
20
|
+
description: 'The person asked to see the page this Session handed over.',
|
|
21
|
+
invocation: { kind: 'direct' },
|
|
22
|
+
parameters: [
|
|
23
|
+
{
|
|
24
|
+
name: 'sessionId',
|
|
25
|
+
source: 'json',
|
|
26
|
+
codec: {
|
|
27
|
+
mode: 'strict',
|
|
28
|
+
typeSymbol: '@mind-harness/mh-browser#mhBrowser/revealHandover:sessionId',
|
|
29
|
+
create: _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0$schema,
|
|
30
|
+
jsonSchema: {"type":"string"},
|
|
31
|
+
},
|
|
32
|
+
strictCodec: {
|
|
33
|
+
mode: 'strict',
|
|
34
|
+
typeSymbol: '@mind-harness/mh-browser#mhBrowser/revealHandover:sessionId',
|
|
35
|
+
create: _mind_harness_mh_browser_mhBrowser_revealHandover_parameter_0_strict$schema,
|
|
36
|
+
jsonSchema: {"type":"string"},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
cancellation: { parameter: 'signal' },
|
|
41
|
+
result: {
|
|
42
|
+
mode: 'strict',
|
|
43
|
+
typeSymbol: '@mind-harness/mh-browser#mhBrowser/revealHandover:result',
|
|
44
|
+
create: _mind_harness_mh_browser_mhBrowser_revealHandover_result$schema,
|
|
45
|
+
jsonSchema: {"type":"object","properties":{"status":{"type":"string","enum":["revealed","not-handing-over","no-tab"]}},"required":["status"],"additionalProperties":true},
|
|
46
|
+
},
|
|
47
|
+
sourceLocation: {"file":"packages/mh-browser/src/service/service.ts","line":571,"column":9},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}, z)
|
|
51
|
+
|
|
52
|
+
export default TYPERT_REMOTE
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from '@deepseek-ai/schemastery';
|
|
2
|
+
import type { BrowserName } from './types.ts';
|
|
3
|
+
export interface BrowserConfig {
|
|
4
|
+
presence: {
|
|
5
|
+
maxBytes: number;
|
|
6
|
+
};
|
|
7
|
+
browser: BrowserName;
|
|
8
|
+
profileDir?: string;
|
|
9
|
+
headless: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const browserConfig: z<BrowserConfig>;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { BrowserConfig } from './config.ts';
|
|
3
|
+
import { MhBrowserService } from './service/service.ts';
|
|
4
|
+
export declare const name = "mh-browser";
|
|
5
|
+
export declare const inject: string[];
|
|
6
|
+
export type Config = BrowserConfig;
|
|
7
|
+
export declare const Config: import("@deepseek-ai/schemastery").default<BrowserConfig>;
|
|
8
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
9
|
+
export { MhBrowserService };
|
|
10
|
+
export { readAgentView } from './representation/agent-view.ts';
|
|
11
|
+
export type { AgentViewDoc, AgentViewLink, AgentViewRead } from './representation/agent-view.ts';
|
|
12
|
+
export { MhBrowserError, UNKNOWN_TAB, UNKNOWN_TAB_REASON, unknownTab } from './types.ts';
|
|
13
|
+
export type { BrowserName, Dialog, FetchResponse, PageError, PageView, TabId, TabInfo, WaitFor, } from './types.ts';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { PendingOp } from './fold.ts';
|
|
2
|
+
import type { HeldPage, PresenceReceipt, PresenceSource } from './record.ts';
|
|
3
|
+
interface Removal {
|
|
4
|
+
url: string;
|
|
5
|
+
source: PresenceSource;
|
|
6
|
+
}
|
|
7
|
+
/** In-memory presence set for one process. The log is the source of a set that outlives the process. */
|
|
8
|
+
export declare class PresenceBook {
|
|
9
|
+
private readonly sets;
|
|
10
|
+
private readonly removals;
|
|
11
|
+
private readonly loaded;
|
|
12
|
+
private readonly resume;
|
|
13
|
+
entries(owner: string): HeldPage[];
|
|
14
|
+
isShown(owner: string, url: string): boolean;
|
|
15
|
+
/** Replace the set with addresses the tests already treat as shown. */
|
|
16
|
+
remember(owner: string, urls: readonly string[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Take the set the log folds to, once per process. Pages put before this
|
|
19
|
+
* stay. A non-empty folded set is checked on the next step (a resumed
|
|
20
|
+
* session).
|
|
21
|
+
*/
|
|
22
|
+
load(owner: string, folded: {
|
|
23
|
+
pages: readonly HeldPage[];
|
|
24
|
+
removals: readonly PendingOp[];
|
|
25
|
+
}): void;
|
|
26
|
+
takeResume(owner: string): boolean;
|
|
27
|
+
put(owner: string, urls: readonly string[], source: PresenceSource): PresenceReceipt[];
|
|
28
|
+
remove(owner: string, urls: readonly string[]): PresenceReceipt[];
|
|
29
|
+
peekRemovals(owner: string): Removal[];
|
|
30
|
+
clearRemovals(owner: string): void;
|
|
31
|
+
apply(owner: string, pages: readonly HeldPage[]): void;
|
|
32
|
+
/** The Session is gone; the log rebuilds the set if it comes back. */
|
|
33
|
+
forget(owner: string): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=book.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { HeldPage, PresenceRecord } from './record.ts';
|
|
2
|
+
export interface PresenceLogEvent {
|
|
3
|
+
seq: number;
|
|
4
|
+
type: string;
|
|
5
|
+
data: unknown;
|
|
6
|
+
}
|
|
7
|
+
interface Carried {
|
|
8
|
+
id: string;
|
|
9
|
+
record: PresenceRecord;
|
|
10
|
+
}
|
|
11
|
+
/** A `browser_presence` receipt no reminder has announced yet. */
|
|
12
|
+
export interface PendingOp {
|
|
13
|
+
op: 'put' | 'remove';
|
|
14
|
+
url: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Presence as the session log has it. Plain JSON: it is a session projection
|
|
18
|
+
* state. History reminders fold into `committed`; a reminder still in the
|
|
19
|
+
* inbox, and one a canceled splice discarded, stays pending on top of it.
|
|
20
|
+
*/
|
|
21
|
+
export interface PresenceLogState {
|
|
22
|
+
committed: HeldPage[];
|
|
23
|
+
inbox: {
|
|
24
|
+
'next-step': Array<Carried | null>;
|
|
25
|
+
'next-turn': Array<Carried | null>;
|
|
26
|
+
};
|
|
27
|
+
/** Discarded since the last reminder entered history; the next step re-announces the set. */
|
|
28
|
+
discarded: Carried[];
|
|
29
|
+
/** A reminder entered history since the last summary. */
|
|
30
|
+
visible: boolean;
|
|
31
|
+
/** A summary compacted a reminder and none entered history since. */
|
|
32
|
+
hidden: boolean;
|
|
33
|
+
/** SHA-256 of each reminder text in history since the last summary. */
|
|
34
|
+
shown: string[];
|
|
35
|
+
ops: PendingOp[];
|
|
36
|
+
}
|
|
37
|
+
export declare function initPresenceLog(): PresenceLogState;
|
|
38
|
+
export declare function applyPresenceLog(state: PresenceLogState, event: PresenceLogEvent): PresenceLogState;
|
|
39
|
+
/** The folded set, with pending reminders and unannounced receipts on top. */
|
|
40
|
+
export declare function presenceSet(state: PresenceLogState): {
|
|
41
|
+
pages: HeldPage[];
|
|
42
|
+
removals: PendingOp[];
|
|
43
|
+
};
|
|
44
|
+
/** Events at or after `beforeSeq` are a later fork and are ignored. */
|
|
45
|
+
export declare function foldPresence(events: readonly PresenceLogEvent[], beforeSeq?: number): HeldPage[];
|
|
46
|
+
/** The text of a reminder, as `shown` records it. */
|
|
47
|
+
export declare function textDigest(message: unknown): string;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=fold.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HeldPage, PresenceRecord, PresenceSource } from './record.ts';
|
|
2
|
+
export interface Observation {
|
|
3
|
+
url: string;
|
|
4
|
+
ok: boolean;
|
|
5
|
+
reason?: string;
|
|
6
|
+
title: string;
|
|
7
|
+
representation?: 'agent-view' | 'snapshot';
|
|
8
|
+
version?: string;
|
|
9
|
+
digest?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
observedAt: string;
|
|
12
|
+
body?: string;
|
|
13
|
+
agentViewError?: string;
|
|
14
|
+
fragment?: string;
|
|
15
|
+
requires?: string[];
|
|
16
|
+
/** The Agent View address this page was read from; a `requires` naming it is satisfied. */
|
|
17
|
+
viewUrl?: string;
|
|
18
|
+
bytes: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Removal {
|
|
21
|
+
url: string;
|
|
22
|
+
source: PresenceSource;
|
|
23
|
+
}
|
|
24
|
+
export interface PlannedReminder {
|
|
25
|
+
text: string;
|
|
26
|
+
record: PresenceRecord;
|
|
27
|
+
next: HeldPage[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Decide the next reminder. A baseline lists the whole set; an empty set has
|
|
31
|
+
* no baseline. A delta lists only what changed. Content that does not fit
|
|
32
|
+
* stays in the set as an absence and is not truncated. An unchanged check
|
|
33
|
+
* returns nothing.
|
|
34
|
+
*/
|
|
35
|
+
export declare function planReminder(input: {
|
|
36
|
+
pages: readonly HeldPage[];
|
|
37
|
+
observations: readonly Observation[];
|
|
38
|
+
removals: readonly Removal[];
|
|
39
|
+
maxBytes: number;
|
|
40
|
+
baseline: boolean;
|
|
41
|
+
replaces: boolean;
|
|
42
|
+
/** Re-announce the current set. A discarded reminder never reached the model. */
|
|
43
|
+
force?: boolean;
|
|
44
|
+
}): PlannedReminder | undefined;
|
|
45
|
+
/** Walk in put order. A page that does not fit is absent and its bytes are not counted. */
|
|
46
|
+
export declare function applyBudget(pages: readonly HeldPage[], maxBytes: number): HeldPage[];
|
|
47
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Structured presence record carried on a message source. The model sees the rendered text, not this. */
|
|
2
|
+
export declare const PRESENCE_SOURCES: readonly ["person via sidebar", "cwd reference", "model"];
|
|
3
|
+
export type PresenceSource = (typeof PRESENCE_SOURCES)[number];
|
|
4
|
+
export type PresenceOp = 'present' | 'added' | 'changed' | 'absent' | 'removed';
|
|
5
|
+
export interface PresenceEntryRecord {
|
|
6
|
+
op: PresenceOp;
|
|
7
|
+
url: string;
|
|
8
|
+
source: PresenceSource;
|
|
9
|
+
version?: string;
|
|
10
|
+
observedAt: string;
|
|
11
|
+
digest: string;
|
|
12
|
+
/** The `id` the Agent View declares; `browser_invoke` takes it as well as `url`. */
|
|
13
|
+
id?: string;
|
|
14
|
+
reason?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PresenceRecord {
|
|
17
|
+
kind: 'baseline' | 'delta';
|
|
18
|
+
replaces?: true;
|
|
19
|
+
entries: PresenceEntryRecord[];
|
|
20
|
+
}
|
|
21
|
+
/** One page in the folded presence set. */
|
|
22
|
+
export interface HeldPage {
|
|
23
|
+
url: string;
|
|
24
|
+
source: PresenceSource;
|
|
25
|
+
state: 'committed' | 'pending';
|
|
26
|
+
order: number;
|
|
27
|
+
seen?: {
|
|
28
|
+
version?: string;
|
|
29
|
+
digest: string;
|
|
30
|
+
observedAt: string;
|
|
31
|
+
id?: string;
|
|
32
|
+
} | {
|
|
33
|
+
absent: string;
|
|
34
|
+
};
|
|
35
|
+
title?: string;
|
|
36
|
+
representation?: 'agent-view' | 'snapshot';
|
|
37
|
+
body?: string;
|
|
38
|
+
agentViewError?: string;
|
|
39
|
+
fragment?: string;
|
|
40
|
+
requires?: string[];
|
|
41
|
+
viewUrl?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface PresenceReceipt {
|
|
44
|
+
url: string;
|
|
45
|
+
receipt: 'added (pending)' | 'already in presence' | 'removed (pending)' | 'not in presence';
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=record.d.ts.map
|