@getmateo/client 0.17.1 → 0.18.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/dist/connection/owned.js +9 -5
- package/dist/daemon-client.d.ts +22 -0
- package/dist/daemon-client.js +44 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/package.json +9 -4
package/dist/connection/owned.js
CHANGED
|
@@ -102,11 +102,15 @@ export class OwnedSubscriptions {
|
|
|
102
102
|
receive: (message) => {
|
|
103
103
|
if (disposed || ("payload" in message && Object.is(message.payload, snapshot)))
|
|
104
104
|
return;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
buffered.length
|
|
109
|
-
|
|
105
|
+
// An executor command may contain signed URLs. Deliver once to live observers;
|
|
106
|
+
// never retain/replay it when another observer attaches to this registration.
|
|
107
|
+
if (message.type !== "browser.plugin_host.execute.request") {
|
|
108
|
+
if (buffered.length < MAX_BOOTSTRAP_UPDATES && !overflow)
|
|
109
|
+
buffered.push(message);
|
|
110
|
+
else {
|
|
111
|
+
buffered.length = 0;
|
|
112
|
+
overflow = true;
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
for (const observer of observers)
|
|
112
116
|
deliver(observer, message);
|
package/dist/daemon-client.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type { AgentConfigApply, MutableDaemonConfig, MutableDaemonConfigPatch }
|
|
|
15
15
|
import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
|
|
16
16
|
import { type TerminalStreamEvent } from "./terminal-stream-router.js";
|
|
17
17
|
import type { BrowserAutomationExecuteRequest, BrowserAutomationExecuteResponse } from "@getmateo/protocol/browser-automation/rpc-schemas";
|
|
18
|
+
import { type PluginBrowserCommand, type PluginBrowserOutcome } from "@getmateo/protocol/plugin-browser";
|
|
19
|
+
import type { PluginBrowserGrantSnapshot } from "@getmateo/protocol/plugin-browser-grants";
|
|
18
20
|
export interface Logger {
|
|
19
21
|
debug(obj: object, msg?: string): void;
|
|
20
22
|
info(obj: object, msg?: string): void;
|
|
@@ -929,6 +931,24 @@ export declare class DaemonClient {
|
|
|
929
931
|
startWorkspaceScript(workspaceId: string, scriptName: string, requestId?: string): Promise<Extract<SessionOutboundMessage, {
|
|
930
932
|
type: "start_workspace_script_response";
|
|
931
933
|
}>["payload"]>;
|
|
934
|
+
supportsPluginWorkspaceBrowser(): boolean;
|
|
935
|
+
executePluginBrowser(workspaceId: string, command: PluginBrowserCommand): Promise<PluginBrowserOutcome>;
|
|
936
|
+
setPluginBrowserGrants(subscriptionId: string, snapshot: PluginBrowserGrantSnapshot): Promise<boolean>;
|
|
937
|
+
sendPluginBrowserHostResponse(requestId: string, outcome: PluginBrowserOutcome): Promise<void>;
|
|
938
|
+
listWorkspaceBrowserDownloads(workspaceId: string): Promise<{
|
|
939
|
+
id: string;
|
|
940
|
+
browserId: string | null;
|
|
941
|
+
workspaceId: string | null;
|
|
942
|
+
serverId: string | null;
|
|
943
|
+
status: "completed" | "failed" | "cancelled";
|
|
944
|
+
path: string | null;
|
|
945
|
+
url: string;
|
|
946
|
+
filename: string;
|
|
947
|
+
bytes: number;
|
|
948
|
+
mimeType: string;
|
|
949
|
+
finishedAt: string;
|
|
950
|
+
error?: string | undefined;
|
|
951
|
+
}[]>;
|
|
932
952
|
listWorkspaceScripts(workspaceId: string, requestId?: string): Promise<Extract<SessionOutboundMessage, {
|
|
933
953
|
type: "workspace.script.list.response";
|
|
934
954
|
}>["payload"]>;
|
|
@@ -1475,6 +1495,8 @@ export declare class DaemonClient {
|
|
|
1475
1495
|
onTerminalStreamEvent(handler: (event: TerminalStreamEvent) => void): () => void;
|
|
1476
1496
|
waitForTerminalStreamEvent(predicate: (event: TerminalStreamEvent) => boolean, timeout?: number): Promise<TerminalStreamEvent>;
|
|
1477
1497
|
private createRequestId;
|
|
1498
|
+
/** True only when this connection actually presented the desktop-managed target's token. */
|
|
1499
|
+
usesLocalCredential(): boolean;
|
|
1478
1500
|
getLastServerInfoMessage(): ServerInfoStatusPayload | null;
|
|
1479
1501
|
private requireHubRelationshipSupport;
|
|
1480
1502
|
private requireDaemonConfigReloadSupport;
|
package/dist/daemon-client.js
CHANGED
|
@@ -16,6 +16,7 @@ import { createRelayE2eeTransportFactory, createRelayTransportFactory, createWeb
|
|
|
16
16
|
import { DaemonClientRuntimeMetrics } from "./daemon-client-runtime-metrics.js";
|
|
17
17
|
import { normalizeListProviderModelsPayload, normalizeProviderSnapshotUpdateMessage, normalizeProvidersSnapshotPayload, } from "./compat/normalize-provider-models.js";
|
|
18
18
|
import { TerminalStreamRouter } from "./terminal-stream-router.js";
|
|
19
|
+
import { isPrivateBrowserControlFrame, } from "@getmateo/protocol/plugin-browser";
|
|
19
20
|
const consoleLogger = {
|
|
20
21
|
debug: () => { },
|
|
21
22
|
info: (obj, msg) => console.log(msg, obj),
|
|
@@ -1963,6 +1964,42 @@ export class DaemonClient {
|
|
|
1963
1964
|
responseType: "start_workspace_script_response",
|
|
1964
1965
|
});
|
|
1965
1966
|
}
|
|
1967
|
+
supportsPluginWorkspaceBrowser() {
|
|
1968
|
+
return this.lastServerInfoMessage?.features?.pluginBrowserVersion === 1;
|
|
1969
|
+
}
|
|
1970
|
+
// Private wire driver, not a method of the public MateoApi (including hosts.connect).
|
|
1971
|
+
async executePluginBrowser(workspaceId, command) {
|
|
1972
|
+
if (!this.supportsPluginWorkspaceBrowser())
|
|
1973
|
+
throw new Error("Update the local Mateo host to use plugin browser controls.");
|
|
1974
|
+
const { outcome } = await this.sendCorrelatedSessionRequest({
|
|
1975
|
+
message: { type: "plugin.browser.execute.request", workspaceId, command },
|
|
1976
|
+
responseType: "plugin.browser.execute.response",
|
|
1977
|
+
timeout: 40000,
|
|
1978
|
+
});
|
|
1979
|
+
return outcome;
|
|
1980
|
+
}
|
|
1981
|
+
async setPluginBrowserGrants(subscriptionId, snapshot) {
|
|
1982
|
+
const { accepted } = await this.sendCorrelatedSessionRequest({
|
|
1983
|
+
message: { type: "browser.plugin_host.set_grants.request", subscriptionId, snapshot },
|
|
1984
|
+
responseType: "browser.plugin_host.set_grants.response",
|
|
1985
|
+
});
|
|
1986
|
+
return accepted;
|
|
1987
|
+
}
|
|
1988
|
+
sendPluginBrowserHostResponse(requestId, outcome) {
|
|
1989
|
+
return this.sendSessionMessageStrict({
|
|
1990
|
+
type: "browser.plugin_host.execute.response",
|
|
1991
|
+
payload: { requestId, outcome },
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
async listWorkspaceBrowserDownloads(workspaceId) {
|
|
1995
|
+
if (this.lastServerInfoMessage?.features?.browserDownloadReceipts !== true)
|
|
1996
|
+
throw new Error("Update the host to query browser download receipts.");
|
|
1997
|
+
const { downloads } = await this.sendCorrelatedSessionRequest({
|
|
1998
|
+
message: { type: "browser.list_downloads.request", workspaceId },
|
|
1999
|
+
responseType: "browser.list_downloads.response",
|
|
2000
|
+
});
|
|
2001
|
+
return downloads;
|
|
2002
|
+
}
|
|
1966
2003
|
async listWorkspaceScripts(workspaceId, requestId) {
|
|
1967
2004
|
return this.sendCorrelatedSessionRequest({
|
|
1968
2005
|
requestId,
|
|
@@ -4734,6 +4771,10 @@ export class DaemonClient {
|
|
|
4734
4771
|
createRequestId(requestId) {
|
|
4735
4772
|
return requestId ?? crypto.randomUUID();
|
|
4736
4773
|
}
|
|
4774
|
+
/** True only when this connection actually presented the desktop-managed target's token. */
|
|
4775
|
+
usesLocalCredential() {
|
|
4776
|
+
return this.isConnected && this.helloAuth?.kind === "localCredential";
|
|
4777
|
+
}
|
|
4737
4778
|
getLastServerInfoMessage() {
|
|
4738
4779
|
return this.lastServerInfoMessage;
|
|
4739
4780
|
}
|
|
@@ -4903,7 +4944,9 @@ export class DaemonClient {
|
|
|
4903
4944
|
? parsedJson.type
|
|
4904
4945
|
: "unknown";
|
|
4905
4946
|
const msgType = responseIdentity?.responseType ?? envelopeType;
|
|
4906
|
-
this.logger.warn(
|
|
4947
|
+
this.logger.warn(isPrivateBrowserControlFrame(parsedJson)
|
|
4948
|
+
? { msgType: "private browser control" }
|
|
4949
|
+
: { msgType, error: parsed.error.message }, "Message validation failed");
|
|
4907
4950
|
if (responseIdentity) {
|
|
4908
4951
|
this.rejectWaitersForRequestId(responseIdentity.requestId, new DaemonProtocolError(responseIdentity));
|
|
4909
4952
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AgentAddress } from "@getmateo/protocol/addresses";
|
|
2
2
|
export type { AgentAddress } from "@getmateo/protocol/addresses";
|
|
3
|
+
import type { BrowserDownloadReceipt } from "@getmateo/protocol/browser-automation/rpc-schemas";
|
|
4
|
+
export type { BrowserDownloadReceipt } from "@getmateo/protocol/browser-automation/rpc-schemas";
|
|
3
5
|
import { type MateoHostActions } from "./hosts/index.js";
|
|
4
6
|
export type { MateoHostActions } from "./hosts/index.js";
|
|
5
7
|
export { enrollFleet, fleetConnection, removeFleetMember, FleetEnrollmentError, type FleetEnrollmentOptions, type FleetCredential, type FleetMember, type FleetStatus, type FleetProject, } from "./fleet/index.js";
|
|
@@ -113,6 +115,7 @@ export interface MateoWorkspaceHandle {
|
|
|
113
115
|
create(options: MateoWorkspaceAgentCreateOptions): Promise<MateoAgentHandle>;
|
|
114
116
|
};
|
|
115
117
|
readonly terminals: MateoWorkspaceTerminalActions;
|
|
118
|
+
listBrowserDownloads(): Promise<BrowserDownloadReceipt[]>;
|
|
116
119
|
current(): MateoWorkspace | null;
|
|
117
120
|
refresh(options?: {
|
|
118
121
|
requestId?: string;
|
package/dist/index.js
CHANGED
|
@@ -298,6 +298,7 @@ function createWorkspaceHandleFactory(daemonClient, createAgent, terminals, list
|
|
|
298
298
|
},
|
|
299
299
|
current: () => current,
|
|
300
300
|
refresh,
|
|
301
|
+
listBrowserDownloads: () => daemonClient.listWorkspaceBrowserDownloads(id),
|
|
301
302
|
setTitle: (title, requestId) => daemonClient.setWorkspaceTitle(id, title, requestId),
|
|
302
303
|
archive: async (requestId) => {
|
|
303
304
|
const result = await daemonClient.archiveWorkspace(id, requestId);
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getmateo/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Mateo client SDK package",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/x2x3studio/mateo.git",
|
|
9
|
+
"directory": "packages/client"
|
|
10
|
+
},
|
|
6
11
|
"files": [
|
|
7
12
|
"dist",
|
|
8
13
|
"!dist/**/*.map",
|
|
@@ -48,10 +53,10 @@
|
|
|
48
53
|
"test": "vitest run"
|
|
49
54
|
},
|
|
50
55
|
"dependencies": {
|
|
51
|
-
"@getmateo/protocol": "0.
|
|
52
|
-
"@getmateo/relay": "0.
|
|
56
|
+
"@getmateo/protocol": "0.18.0",
|
|
57
|
+
"@getmateo/relay": "0.18.0",
|
|
53
58
|
"ws": "^8.23.0",
|
|
54
|
-
"zod": "
|
|
59
|
+
"zod": "4.6.7"
|
|
55
60
|
},
|
|
56
61
|
"devDependencies": {
|
|
57
62
|
"@types/node": "^20.9.0",
|