@mearl/cloud-connector 2.6.1 → 2.7.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/README.md +28 -2
- package/dist/__tests__/endpoint.test.d.ts +1 -0
- package/dist/__tests__/qoder.test.d.ts +1 -0
- package/dist/cli.js +546 -14
- package/dist/endpoint.d.ts +20 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +549 -7
- package/dist/qoder.d.ts +106 -0
- package/package.json +7 -6
package/dist/qoder.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ConnectorIdentity } from './identity.js';
|
|
2
|
+
import type { QoderConnectorEndpoint } from './endpoint.js';
|
|
3
|
+
export declare const QODER_TOOL_NAME = "mearl";
|
|
4
|
+
export declare const DEFAULT_QODER_API_BASE_URL = "https://api.qoder.com";
|
|
5
|
+
export type QoderContentBlock = {
|
|
6
|
+
type: 'text';
|
|
7
|
+
text: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'image';
|
|
10
|
+
source: {
|
|
11
|
+
type: 'base64';
|
|
12
|
+
media_type: 'image/png' | 'image/jpeg';
|
|
13
|
+
data: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export interface QoderPublicEvent {
|
|
17
|
+
id?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
input?: unknown;
|
|
21
|
+
processed_at?: string;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
interface QoderSession {
|
|
25
|
+
id: string;
|
|
26
|
+
status?: string;
|
|
27
|
+
updated_at?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface QoderPairingRequest {
|
|
30
|
+
sessionId: string;
|
|
31
|
+
event: QoderPublicEvent & {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface QoderSseFrame {
|
|
36
|
+
id?: string;
|
|
37
|
+
event?: string;
|
|
38
|
+
data: QoderPublicEvent;
|
|
39
|
+
}
|
|
40
|
+
export declare class QoderApiError extends Error {
|
|
41
|
+
readonly status: number;
|
|
42
|
+
constructor(message: string, status: number);
|
|
43
|
+
}
|
|
44
|
+
export interface FormattedQoderResult {
|
|
45
|
+
content: QoderContentBlock[];
|
|
46
|
+
fallbackContent: QoderContentBlock[];
|
|
47
|
+
}
|
|
48
|
+
/** Format screenshots as multimodal tool results while retaining a text-only API fallback. */
|
|
49
|
+
export declare function formatQoderToolResult(value: unknown): FormattedQoderResult;
|
|
50
|
+
export declare class QoderApiClient {
|
|
51
|
+
private readonly token;
|
|
52
|
+
private readonly fetchImpl;
|
|
53
|
+
private readonly baseUrl;
|
|
54
|
+
constructor(token: string, baseUrl?: string, fetchImpl?: typeof fetch);
|
|
55
|
+
private request;
|
|
56
|
+
listSessions(createdAfter: string, signal?: AbortSignal): Promise<QoderSession[]>;
|
|
57
|
+
listCustomToolEvents(sessionId: string, createdAfter: string, signal?: AbortSignal): Promise<QoderPublicEvent[]>;
|
|
58
|
+
findPairingRequest(pairingCode: string, createdAfter: string, signal?: AbortSignal): Promise<QoderPairingRequest | null>;
|
|
59
|
+
sendCustomToolResult(sessionId: string, customToolUseId: string, content: QoderContentBlock[], isError?: boolean, signal?: AbortSignal): Promise<string | undefined>;
|
|
60
|
+
streamEvents(sessionId: string, lastEventId: string | undefined, signal: AbortSignal, onFrame: (frame: QoderSseFrame) => Promise<void>, onOpen?: () => void): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export declare function parseQoderSse(body: ReadableStream<Uint8Array>, onFrame: (frame: QoderSseFrame) => Promise<void>): Promise<void>;
|
|
63
|
+
export interface QoderConnectorOptions {
|
|
64
|
+
endpoint: QoderConnectorEndpoint;
|
|
65
|
+
identity: ConnectorIdentity;
|
|
66
|
+
reconnectInterval?: number;
|
|
67
|
+
maxReconnectAttempts?: number;
|
|
68
|
+
failFast?: boolean;
|
|
69
|
+
token?: string;
|
|
70
|
+
apiBaseUrl?: string;
|
|
71
|
+
fetchImpl?: typeof fetch;
|
|
72
|
+
now?: () => number;
|
|
73
|
+
sleep?: (milliseconds: number, signal: AbortSignal) => Promise<void>;
|
|
74
|
+
invokeAction?: (action: string, payload: Record<string, unknown>, options: {
|
|
75
|
+
browser?: string;
|
|
76
|
+
timeoutSec: number;
|
|
77
|
+
}) => Promise<unknown>;
|
|
78
|
+
onConnected?: () => void;
|
|
79
|
+
onInitialConnectionFailed?: (message: string) => void;
|
|
80
|
+
}
|
|
81
|
+
export declare class QoderConnector {
|
|
82
|
+
private readonly options;
|
|
83
|
+
private readonly api;
|
|
84
|
+
private readonly now;
|
|
85
|
+
private readonly sleep;
|
|
86
|
+
private readonly invokeAction;
|
|
87
|
+
private readonly reconnectInterval;
|
|
88
|
+
private readonly maxReconnectAttempts;
|
|
89
|
+
private abortController;
|
|
90
|
+
private reconnectAttempts;
|
|
91
|
+
private running;
|
|
92
|
+
private connected;
|
|
93
|
+
private sessionId;
|
|
94
|
+
private lastEventId;
|
|
95
|
+
private readonly cachedResults;
|
|
96
|
+
constructor(options: QoderConnectorOptions);
|
|
97
|
+
connect(): void;
|
|
98
|
+
disconnect(): void;
|
|
99
|
+
private run;
|
|
100
|
+
private findPairing;
|
|
101
|
+
private completePairing;
|
|
102
|
+
private handleFrame;
|
|
103
|
+
private executeTool;
|
|
104
|
+
private rememberResult;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/cloud-connector",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Cloud connector for Mearl — bridges cloud
|
|
3
|
+
"version": "2.7.0",
|
|
4
|
+
"description": "Cloud connector for Mearl — bridges cloud agents to a local native-host",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"keywords": [
|
|
21
21
|
"mearl",
|
|
22
22
|
"cloud-connector",
|
|
23
|
-
"websocket"
|
|
23
|
+
"websocket",
|
|
24
|
+
"qoder"
|
|
24
25
|
],
|
|
25
26
|
"license": "ISC",
|
|
26
27
|
"publishConfig": {
|
|
@@ -28,9 +29,9 @@
|
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"ws": "^8.18.0",
|
|
31
|
-
"@mearl/
|
|
32
|
-
"@mearl/client": "2.
|
|
33
|
-
"@mearl/
|
|
32
|
+
"@mearl/cloud-types": "2.7.0",
|
|
33
|
+
"@mearl/client": "2.7.0",
|
|
34
|
+
"@mearl/daemon-core": "2.7.0"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/node": "^24.9.1",
|