@mind-harness/mh-browser 0.0.0-stage → 0.1.1
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 +6194 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +360 -0
- package/lib/typert.remote-client.d.ts +24 -0
- package/lib/typert.remote-client.js +52 -0
- package/lib/types/config.d.ts +20 -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 +64 -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 +172 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +76 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { LogReader } from '../projections.ts';
|
|
3
|
+
import type { ToolSession } from './session.ts';
|
|
4
|
+
/** Tabs an mh-browser result named and no later result reported closed. Plain JSON: a session projection state. */
|
|
5
|
+
export interface TabLogState {
|
|
6
|
+
open: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function initTabLog(): TabLogState;
|
|
9
|
+
export declare function applyTabLog(state: TabLogState, event: {
|
|
10
|
+
type: string;
|
|
11
|
+
data: unknown;
|
|
12
|
+
}): TabLogState;
|
|
13
|
+
/**
|
|
14
|
+
* The closed notes for this result: the service's own, then each tab an
|
|
15
|
+
* earlier result named that is gone without a note, as after a browser restart.
|
|
16
|
+
*/
|
|
17
|
+
export declare function closedNotes(ctx: Context, reader: LogReader, session: ToolSession): string[];
|
|
18
|
+
//# sourceMappingURL=tab-log.d.ts.map
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/** Public browser types. Playwright types stay inside the service. */
|
|
2
|
+
export type BrowserName = 'chrome' | 'msedge' | 'chromium';
|
|
3
|
+
export type OwnerId = string;
|
|
4
|
+
export type TabId = string;
|
|
5
|
+
export interface WaitFor {
|
|
6
|
+
text?: string;
|
|
7
|
+
textGone?: string;
|
|
8
|
+
/** Seconds. Capped at 30. */
|
|
9
|
+
time?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface FetchResponseBody {
|
|
12
|
+
kind: 'response';
|
|
13
|
+
finalUrl: string;
|
|
14
|
+
status: number;
|
|
15
|
+
mediaType?: string;
|
|
16
|
+
etag?: string;
|
|
17
|
+
link?: string;
|
|
18
|
+
body: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
export type FetchResponse = FetchResponseBody | {
|
|
21
|
+
kind: 'error';
|
|
22
|
+
reason: string;
|
|
23
|
+
};
|
|
24
|
+
export interface Dialog {
|
|
25
|
+
type: string;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
export interface PageView {
|
|
29
|
+
tab: TabId;
|
|
30
|
+
url: string;
|
|
31
|
+
title: string;
|
|
32
|
+
observedAt: string;
|
|
33
|
+
representation: {
|
|
34
|
+
kind: 'agent-view';
|
|
35
|
+
text: string;
|
|
36
|
+
version?: string;
|
|
37
|
+
/** The address the Agent View was read from: the page itself, or its `rel=agent-view`. */
|
|
38
|
+
href?: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'snapshot';
|
|
41
|
+
text: string;
|
|
42
|
+
agentViewError?: string;
|
|
43
|
+
/** Set on an action result when this page also has a readable Agent View. */
|
|
44
|
+
agentView?: {
|
|
45
|
+
version?: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
fragment?: string;
|
|
49
|
+
status?: number;
|
|
50
|
+
mediaType?: string;
|
|
51
|
+
/** Response text of a textual non-HTML document navigation, shown in place of the snapshot. */
|
|
52
|
+
body?: string;
|
|
53
|
+
inPresence: boolean;
|
|
54
|
+
dialog?: Dialog;
|
|
55
|
+
incomplete?: {
|
|
56
|
+
load: boolean;
|
|
57
|
+
pendingRequests: number;
|
|
58
|
+
};
|
|
59
|
+
waited?: {
|
|
60
|
+
met: 'text' | 'textGone' | 'time' | false;
|
|
61
|
+
seconds: number;
|
|
62
|
+
};
|
|
63
|
+
download?: Download;
|
|
64
|
+
}
|
|
65
|
+
export interface PageError {
|
|
66
|
+
tab?: TabId;
|
|
67
|
+
url: string;
|
|
68
|
+
reason: string;
|
|
69
|
+
}
|
|
70
|
+
export interface TabInfo {
|
|
71
|
+
tab: TabId;
|
|
72
|
+
url: string;
|
|
73
|
+
title: string;
|
|
74
|
+
occupied: boolean;
|
|
75
|
+
inPresence: boolean;
|
|
76
|
+
mayHaveChanged: boolean;
|
|
77
|
+
}
|
|
78
|
+
export type ActAction = {
|
|
79
|
+
kind: 'click';
|
|
80
|
+
ref: string;
|
|
81
|
+
double?: boolean;
|
|
82
|
+
button?: 'left' | 'right' | 'middle';
|
|
83
|
+
modifiers?: Array<'Alt' | 'Control' | 'Meta' | 'Shift'>;
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'select';
|
|
86
|
+
ref: string;
|
|
87
|
+
values: string[];
|
|
88
|
+
} | {
|
|
89
|
+
kind: 'press';
|
|
90
|
+
key: string;
|
|
91
|
+
ref?: string;
|
|
92
|
+
} | {
|
|
93
|
+
kind: 'fill';
|
|
94
|
+
fields: {
|
|
95
|
+
ref: string;
|
|
96
|
+
value: string;
|
|
97
|
+
}[];
|
|
98
|
+
} | {
|
|
99
|
+
kind: 'upload';
|
|
100
|
+
ref: string;
|
|
101
|
+
files: string[];
|
|
102
|
+
} | {
|
|
103
|
+
kind: 'dialog';
|
|
104
|
+
accept: boolean;
|
|
105
|
+
promptText?: string;
|
|
106
|
+
} | {
|
|
107
|
+
kind: 'back';
|
|
108
|
+
} | {
|
|
109
|
+
kind: 'wait';
|
|
110
|
+
text?: string;
|
|
111
|
+
textGone?: string;
|
|
112
|
+
time?: number;
|
|
113
|
+
} | {
|
|
114
|
+
kind: 'look';
|
|
115
|
+
};
|
|
116
|
+
export declare class MhBrowserError extends Error {
|
|
117
|
+
readonly code: string;
|
|
118
|
+
readonly page?: PageView;
|
|
119
|
+
constructor(code: string, message: string, page?: PageView);
|
|
120
|
+
}
|
|
121
|
+
/** Owner of the person's own window. It belongs to no Session. */
|
|
122
|
+
export declare const PERSON_OWNER = "person";
|
|
123
|
+
export declare const UNKNOWN_TAB = "UNKNOWN_TAB";
|
|
124
|
+
export declare const UNKNOWN_TAB_REASON = "no such tab in this session";
|
|
125
|
+
/**
|
|
126
|
+
* Internal: a wait ended because its signal aborted. A tool never reports it:
|
|
127
|
+
* a stopped call ends as the tool runtime's abort, a takeover as `TAKEN_OVER`.
|
|
128
|
+
*/
|
|
129
|
+
export declare const INTERRUPTED = "INTERRUPTED";
|
|
130
|
+
/** The browser did not start or could not be restarted. */
|
|
131
|
+
export declare const BROWSER_UNAVAILABLE = "BROWSER_UNAVAILABLE";
|
|
132
|
+
export declare function unknownTab(): PageError;
|
|
133
|
+
export type Download = {
|
|
134
|
+
kind: 'saved';
|
|
135
|
+
path: string;
|
|
136
|
+
url: string;
|
|
137
|
+
mediaType?: string;
|
|
138
|
+
bytes: number;
|
|
139
|
+
sha256: string;
|
|
140
|
+
observed: string;
|
|
141
|
+
} | {
|
|
142
|
+
kind: 'error';
|
|
143
|
+
url: string;
|
|
144
|
+
status?: number;
|
|
145
|
+
reason: string;
|
|
146
|
+
};
|
|
147
|
+
export interface ActionResponse {
|
|
148
|
+
name: string;
|
|
149
|
+
status?: number;
|
|
150
|
+
location?: string;
|
|
151
|
+
mediaType?: string;
|
|
152
|
+
body?: string;
|
|
153
|
+
bytes?: number;
|
|
154
|
+
lost?: boolean;
|
|
155
|
+
}
|
|
156
|
+
export interface InvokeCall {
|
|
157
|
+
name: string;
|
|
158
|
+
item?: string;
|
|
159
|
+
input?: Record<string, unknown>;
|
|
160
|
+
seen: SeenView | 'not-in-context';
|
|
161
|
+
}
|
|
162
|
+
/** The Agent View the model saw last: its declared `version` when it had one, and its digest. */
|
|
163
|
+
export interface SeenView {
|
|
164
|
+
digest: string;
|
|
165
|
+
version?: string;
|
|
166
|
+
}
|
|
167
|
+
export interface InvokeSent {
|
|
168
|
+
schemaRejected: boolean;
|
|
169
|
+
response?: ActionResponse;
|
|
170
|
+
page: PageView | PageError;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=types.d.ts.map
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,79 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mind-harness/mh-browser",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
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
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib/index.js",
|
|
8
|
+
"lib/types/representation/agent-view.js",
|
|
9
|
+
"lib/types/**/*.d.ts",
|
|
10
|
+
"lib/typert.host.js",
|
|
11
|
+
"lib/typert.host.d.ts",
|
|
12
|
+
"lib/typert.remote-client.js",
|
|
13
|
+
"lib/typert.remote-client.d.ts",
|
|
14
|
+
"locale/*.json",
|
|
15
|
+
"icon.svg",
|
|
16
|
+
"extension/*"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./lib/index.js",
|
|
20
|
+
"types": "./lib/types/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./lib/types/index.d.ts",
|
|
24
|
+
"default": "./lib/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./agent-view": {
|
|
27
|
+
"types": "./lib/types/representation/agent-view.d.ts",
|
|
28
|
+
"default": "./lib/types/representation/agent-view.js"
|
|
29
|
+
},
|
|
30
|
+
"./typert": {
|
|
31
|
+
"types": "./lib/typert.host.d.ts",
|
|
32
|
+
"default": "./lib/typert.host.js"
|
|
33
|
+
},
|
|
34
|
+
"./remote": {
|
|
35
|
+
"types": "./lib/typert.remote-client.d.ts",
|
|
36
|
+
"default": "./lib/typert.remote-client.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json",
|
|
39
|
+
"./locale/*.json": "./locale/*.json",
|
|
40
|
+
"./icon": "./icon.svg"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"playwright": "1.64.1",
|
|
47
|
+
"yaml": "^2.9.1",
|
|
48
|
+
"zod": "4.4.3"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
52
|
+
"@deepseek-ai/dsh-agent": "0.2.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.1-rc.3",
|
|
54
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-rc.3",
|
|
55
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-rc.3",
|
|
56
|
+
"@deepseek-ai/dsh-browser-use": "0.2.1-rc.3",
|
|
57
|
+
"@deepseek-ai/dsh-home-paths": "0.2.1-rc.3",
|
|
58
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.3",
|
|
59
|
+
"@deepseek-ai/dsh-llm-mock-server": "0.2.1-rc.3",
|
|
60
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.1-rc.3",
|
|
61
|
+
"@deepseek-ai/dsh-session": "0.2.1-rc.3",
|
|
62
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-rc.3",
|
|
63
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.3",
|
|
64
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.3",
|
|
65
|
+
"@deepseek-ai/dsh-user-questions": "0.2.1-rc.3",
|
|
66
|
+
"@deepseek-ai/schemastery": "3.18.5"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"@deepseek-ai/cordis": "~4.0.5",
|
|
70
|
+
"@deepseek-ai/dsh-home-paths": ">=0.2.1-rc.3 <0.3.0",
|
|
71
|
+
"@deepseek-ai/dsh-llm": ">=0.2.1-rc.3 <0.3.0",
|
|
72
|
+
"@deepseek-ai/dsh-tools": ">=0.2.1-rc.3 <0.3.0",
|
|
73
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.2.1-rc.3 <0.3.0",
|
|
74
|
+
"@deepseek-ai/dsh-user-questions": ">=0.2.1-rc.3 <0.3.0",
|
|
75
|
+
"@deepseek-ai/schemastery": "~3.18.5"
|
|
76
|
+
},
|
|
77
|
+
"icon": "./icon.svg",
|
|
78
|
+
"scripts": {}
|
|
6
79
|
}
|