@yesod/openclaw 0.0.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/dist/index.cjs +88 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +45 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/package.json +37 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
GatewayApiClient: () => GatewayApiClient,
|
|
24
|
+
GatewayWebSocketClient: () => GatewayWebSocketClient,
|
|
25
|
+
OpenClawAdapter: () => OpenClawAdapter
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
|
+
|
|
29
|
+
// src/adapter.ts
|
|
30
|
+
var OpenClawAdapter = class {
|
|
31
|
+
constructor(gatewayUrl, authToken) {
|
|
32
|
+
this.gatewayUrl = gatewayUrl;
|
|
33
|
+
this.authToken = authToken;
|
|
34
|
+
}
|
|
35
|
+
gatewayUrl;
|
|
36
|
+
authToken;
|
|
37
|
+
async connect() {
|
|
38
|
+
}
|
|
39
|
+
async disconnect() {
|
|
40
|
+
}
|
|
41
|
+
onEvent(_handler) {
|
|
42
|
+
}
|
|
43
|
+
async sendNotification(_sessionId, _message) {
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/websocket.ts
|
|
48
|
+
var GatewayWebSocketClient = class {
|
|
49
|
+
constructor(gatewayUrl, authToken) {
|
|
50
|
+
this.gatewayUrl = gatewayUrl;
|
|
51
|
+
this.authToken = authToken;
|
|
52
|
+
}
|
|
53
|
+
gatewayUrl;
|
|
54
|
+
authToken;
|
|
55
|
+
handlers = [];
|
|
56
|
+
async connect() {
|
|
57
|
+
}
|
|
58
|
+
async disconnect() {
|
|
59
|
+
}
|
|
60
|
+
onEvent(handler) {
|
|
61
|
+
this.handlers.push(handler);
|
|
62
|
+
}
|
|
63
|
+
/** Subscribe to events for a specific session via sessions.subscribe */
|
|
64
|
+
async subscribeToSession(_sessionId) {
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/api.ts
|
|
69
|
+
var GatewayApiClient = class {
|
|
70
|
+
constructor(options) {
|
|
71
|
+
this.options = options;
|
|
72
|
+
}
|
|
73
|
+
options;
|
|
74
|
+
/** Send a notification to a session via sessions_send */
|
|
75
|
+
async sessionsSend(_sessionId, _message) {
|
|
76
|
+
}
|
|
77
|
+
/** List active sessions */
|
|
78
|
+
async listSessions() {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
GatewayApiClient,
|
|
85
|
+
GatewayWebSocketClient,
|
|
86
|
+
OpenClawAdapter
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/adapter.ts","../src/websocket.ts","../src/api.ts"],"sourcesContent":["export { OpenClawAdapter } from \"./adapter.js\";\nexport type { RuntimeAdapter } from \"./adapter.js\";\n\nexport { GatewayWebSocketClient } from \"./websocket.js\";\nexport type { WebSocketEventHandler } from \"./websocket.js\";\n\nexport { GatewayApiClient } from \"./api.js\";\nexport type { GatewayApiOptions } from \"./api.js\";\n","import type { YesodEvent } from \"@yesod/core\";\n\nexport interface RuntimeAdapter {\n connect(): Promise<void>;\n disconnect(): Promise<void>;\n onEvent(handler: (event: YesodEvent) => void): void;\n sendNotification(sessionId: string, message: string): Promise<void>;\n}\n\nexport class OpenClawAdapter implements RuntimeAdapter {\n constructor(\n private gatewayUrl: string,\n private authToken?: string,\n ) {}\n\n async connect(): Promise<void> {\n // Stub — will establish WebSocket connection and HTTP client\n }\n\n async disconnect(): Promise<void> {\n // Stub — will close connections\n }\n\n onEvent(_handler: (event: YesodEvent) => void): void {\n // Stub — will wire up WebSocket event parsing\n }\n\n async sendNotification(_sessionId: string, _message: string): Promise<void> {\n // Stub — will call sessions_send via Gateway API\n }\n}\n","import type { YesodEvent } from \"@yesod/core\";\n\nexport type WebSocketEventHandler = (event: YesodEvent) => void;\n\nexport class GatewayWebSocketClient {\n private handlers: WebSocketEventHandler[] = [];\n\n constructor(\n private gatewayUrl: string,\n private authToken?: string,\n ) {}\n\n async connect(): Promise<void> {\n // Stub — will connect to Gateway WebSocket and subscribe to session events\n }\n\n async disconnect(): Promise<void> {\n // Stub — will close WebSocket connection\n }\n\n onEvent(handler: WebSocketEventHandler): void {\n this.handlers.push(handler);\n }\n\n /** Subscribe to events for a specific session via sessions.subscribe */\n async subscribeToSession(_sessionId: string): Promise<void> {\n // Stub\n }\n}\n","export interface GatewayApiOptions {\n baseUrl: string;\n authToken?: string;\n}\n\nexport class GatewayApiClient {\n constructor(private options: GatewayApiOptions) {}\n\n /** Send a notification to a session via sessions_send */\n async sessionsSend(\n _sessionId: string,\n _message: string,\n ): Promise<void> {\n // Stub — will POST to Gateway HTTP API\n }\n\n /** List active sessions */\n async listSessions(): Promise<unknown[]> {\n // Stub\n return [];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,kBAAN,MAAgD;AAAA,EACrD,YACU,YACA,WACR;AAFQ;AACA;AAAA,EACP;AAAA,EAFO;AAAA,EACA;AAAA,EAGV,MAAM,UAAyB;AAAA,EAE/B;AAAA,EAEA,MAAM,aAA4B;AAAA,EAElC;AAAA,EAEA,QAAQ,UAA6C;AAAA,EAErD;AAAA,EAEA,MAAM,iBAAiB,YAAoB,UAAiC;AAAA,EAE5E;AACF;;;AC1BO,IAAM,yBAAN,MAA6B;AAAA,EAGlC,YACU,YACA,WACR;AAFQ;AACA;AAAA,EACP;AAAA,EAFO;AAAA,EACA;AAAA,EAJF,WAAoC,CAAC;AAAA,EAO7C,MAAM,UAAyB;AAAA,EAE/B;AAAA,EAEA,MAAM,aAA4B;AAAA,EAElC;AAAA,EAEA,QAAQ,SAAsC;AAC5C,SAAK,SAAS,KAAK,OAAO;AAAA,EAC5B;AAAA;AAAA,EAGA,MAAM,mBAAmB,YAAmC;AAAA,EAE5D;AACF;;;ACvBO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,SAA4B;AAA5B;AAAA,EAA6B;AAAA,EAA7B;AAAA;AAAA,EAGpB,MAAM,aACJ,YACA,UACe;AAAA,EAEjB;AAAA;AAAA,EAGA,MAAM,eAAmC;AAEvC,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { YesodEvent } from '@yesod/core';
|
|
2
|
+
|
|
3
|
+
interface RuntimeAdapter {
|
|
4
|
+
connect(): Promise<void>;
|
|
5
|
+
disconnect(): Promise<void>;
|
|
6
|
+
onEvent(handler: (event: YesodEvent) => void): void;
|
|
7
|
+
sendNotification(sessionId: string, message: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
declare class OpenClawAdapter implements RuntimeAdapter {
|
|
10
|
+
private gatewayUrl;
|
|
11
|
+
private authToken?;
|
|
12
|
+
constructor(gatewayUrl: string, authToken?: string | undefined);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
disconnect(): Promise<void>;
|
|
15
|
+
onEvent(_handler: (event: YesodEvent) => void): void;
|
|
16
|
+
sendNotification(_sessionId: string, _message: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type WebSocketEventHandler = (event: YesodEvent) => void;
|
|
20
|
+
declare class GatewayWebSocketClient {
|
|
21
|
+
private gatewayUrl;
|
|
22
|
+
private authToken?;
|
|
23
|
+
private handlers;
|
|
24
|
+
constructor(gatewayUrl: string, authToken?: string | undefined);
|
|
25
|
+
connect(): Promise<void>;
|
|
26
|
+
disconnect(): Promise<void>;
|
|
27
|
+
onEvent(handler: WebSocketEventHandler): void;
|
|
28
|
+
/** Subscribe to events for a specific session via sessions.subscribe */
|
|
29
|
+
subscribeToSession(_sessionId: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface GatewayApiOptions {
|
|
33
|
+
baseUrl: string;
|
|
34
|
+
authToken?: string;
|
|
35
|
+
}
|
|
36
|
+
declare class GatewayApiClient {
|
|
37
|
+
private options;
|
|
38
|
+
constructor(options: GatewayApiOptions);
|
|
39
|
+
/** Send a notification to a session via sessions_send */
|
|
40
|
+
sessionsSend(_sessionId: string, _message: string): Promise<void>;
|
|
41
|
+
/** List active sessions */
|
|
42
|
+
listSessions(): Promise<unknown[]>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { GatewayApiClient, type GatewayApiOptions, GatewayWebSocketClient, OpenClawAdapter, type RuntimeAdapter, type WebSocketEventHandler };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { YesodEvent } from '@yesod/core';
|
|
2
|
+
|
|
3
|
+
interface RuntimeAdapter {
|
|
4
|
+
connect(): Promise<void>;
|
|
5
|
+
disconnect(): Promise<void>;
|
|
6
|
+
onEvent(handler: (event: YesodEvent) => void): void;
|
|
7
|
+
sendNotification(sessionId: string, message: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
declare class OpenClawAdapter implements RuntimeAdapter {
|
|
10
|
+
private gatewayUrl;
|
|
11
|
+
private authToken?;
|
|
12
|
+
constructor(gatewayUrl: string, authToken?: string | undefined);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
disconnect(): Promise<void>;
|
|
15
|
+
onEvent(_handler: (event: YesodEvent) => void): void;
|
|
16
|
+
sendNotification(_sessionId: string, _message: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type WebSocketEventHandler = (event: YesodEvent) => void;
|
|
20
|
+
declare class GatewayWebSocketClient {
|
|
21
|
+
private gatewayUrl;
|
|
22
|
+
private authToken?;
|
|
23
|
+
private handlers;
|
|
24
|
+
constructor(gatewayUrl: string, authToken?: string | undefined);
|
|
25
|
+
connect(): Promise<void>;
|
|
26
|
+
disconnect(): Promise<void>;
|
|
27
|
+
onEvent(handler: WebSocketEventHandler): void;
|
|
28
|
+
/** Subscribe to events for a specific session via sessions.subscribe */
|
|
29
|
+
subscribeToSession(_sessionId: string): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface GatewayApiOptions {
|
|
33
|
+
baseUrl: string;
|
|
34
|
+
authToken?: string;
|
|
35
|
+
}
|
|
36
|
+
declare class GatewayApiClient {
|
|
37
|
+
private options;
|
|
38
|
+
constructor(options: GatewayApiOptions);
|
|
39
|
+
/** Send a notification to a session via sessions_send */
|
|
40
|
+
sessionsSend(_sessionId: string, _message: string): Promise<void>;
|
|
41
|
+
/** List active sessions */
|
|
42
|
+
listSessions(): Promise<unknown[]>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { GatewayApiClient, type GatewayApiOptions, GatewayWebSocketClient, OpenClawAdapter, type RuntimeAdapter, type WebSocketEventHandler };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/adapter.ts
|
|
2
|
+
var OpenClawAdapter = class {
|
|
3
|
+
constructor(gatewayUrl, authToken) {
|
|
4
|
+
this.gatewayUrl = gatewayUrl;
|
|
5
|
+
this.authToken = authToken;
|
|
6
|
+
}
|
|
7
|
+
gatewayUrl;
|
|
8
|
+
authToken;
|
|
9
|
+
async connect() {
|
|
10
|
+
}
|
|
11
|
+
async disconnect() {
|
|
12
|
+
}
|
|
13
|
+
onEvent(_handler) {
|
|
14
|
+
}
|
|
15
|
+
async sendNotification(_sessionId, _message) {
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// src/websocket.ts
|
|
20
|
+
var GatewayWebSocketClient = class {
|
|
21
|
+
constructor(gatewayUrl, authToken) {
|
|
22
|
+
this.gatewayUrl = gatewayUrl;
|
|
23
|
+
this.authToken = authToken;
|
|
24
|
+
}
|
|
25
|
+
gatewayUrl;
|
|
26
|
+
authToken;
|
|
27
|
+
handlers = [];
|
|
28
|
+
async connect() {
|
|
29
|
+
}
|
|
30
|
+
async disconnect() {
|
|
31
|
+
}
|
|
32
|
+
onEvent(handler) {
|
|
33
|
+
this.handlers.push(handler);
|
|
34
|
+
}
|
|
35
|
+
/** Subscribe to events for a specific session via sessions.subscribe */
|
|
36
|
+
async subscribeToSession(_sessionId) {
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/api.ts
|
|
41
|
+
var GatewayApiClient = class {
|
|
42
|
+
constructor(options) {
|
|
43
|
+
this.options = options;
|
|
44
|
+
}
|
|
45
|
+
options;
|
|
46
|
+
/** Send a notification to a session via sessions_send */
|
|
47
|
+
async sessionsSend(_sessionId, _message) {
|
|
48
|
+
}
|
|
49
|
+
/** List active sessions */
|
|
50
|
+
async listSessions() {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
GatewayApiClient,
|
|
56
|
+
GatewayWebSocketClient,
|
|
57
|
+
OpenClawAdapter
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapter.ts","../src/websocket.ts","../src/api.ts"],"sourcesContent":["import type { YesodEvent } from \"@yesod/core\";\n\nexport interface RuntimeAdapter {\n connect(): Promise<void>;\n disconnect(): Promise<void>;\n onEvent(handler: (event: YesodEvent) => void): void;\n sendNotification(sessionId: string, message: string): Promise<void>;\n}\n\nexport class OpenClawAdapter implements RuntimeAdapter {\n constructor(\n private gatewayUrl: string,\n private authToken?: string,\n ) {}\n\n async connect(): Promise<void> {\n // Stub — will establish WebSocket connection and HTTP client\n }\n\n async disconnect(): Promise<void> {\n // Stub — will close connections\n }\n\n onEvent(_handler: (event: YesodEvent) => void): void {\n // Stub — will wire up WebSocket event parsing\n }\n\n async sendNotification(_sessionId: string, _message: string): Promise<void> {\n // Stub — will call sessions_send via Gateway API\n }\n}\n","import type { YesodEvent } from \"@yesod/core\";\n\nexport type WebSocketEventHandler = (event: YesodEvent) => void;\n\nexport class GatewayWebSocketClient {\n private handlers: WebSocketEventHandler[] = [];\n\n constructor(\n private gatewayUrl: string,\n private authToken?: string,\n ) {}\n\n async connect(): Promise<void> {\n // Stub — will connect to Gateway WebSocket and subscribe to session events\n }\n\n async disconnect(): Promise<void> {\n // Stub — will close WebSocket connection\n }\n\n onEvent(handler: WebSocketEventHandler): void {\n this.handlers.push(handler);\n }\n\n /** Subscribe to events for a specific session via sessions.subscribe */\n async subscribeToSession(_sessionId: string): Promise<void> {\n // Stub\n }\n}\n","export interface GatewayApiOptions {\n baseUrl: string;\n authToken?: string;\n}\n\nexport class GatewayApiClient {\n constructor(private options: GatewayApiOptions) {}\n\n /** Send a notification to a session via sessions_send */\n async sessionsSend(\n _sessionId: string,\n _message: string,\n ): Promise<void> {\n // Stub — will POST to Gateway HTTP API\n }\n\n /** List active sessions */\n async listSessions(): Promise<unknown[]> {\n // Stub\n return [];\n }\n}\n"],"mappings":";AASO,IAAM,kBAAN,MAAgD;AAAA,EACrD,YACU,YACA,WACR;AAFQ;AACA;AAAA,EACP;AAAA,EAFO;AAAA,EACA;AAAA,EAGV,MAAM,UAAyB;AAAA,EAE/B;AAAA,EAEA,MAAM,aAA4B;AAAA,EAElC;AAAA,EAEA,QAAQ,UAA6C;AAAA,EAErD;AAAA,EAEA,MAAM,iBAAiB,YAAoB,UAAiC;AAAA,EAE5E;AACF;;;AC1BO,IAAM,yBAAN,MAA6B;AAAA,EAGlC,YACU,YACA,WACR;AAFQ;AACA;AAAA,EACP;AAAA,EAFO;AAAA,EACA;AAAA,EAJF,WAAoC,CAAC;AAAA,EAO7C,MAAM,UAAyB;AAAA,EAE/B;AAAA,EAEA,MAAM,aAA4B;AAAA,EAElC;AAAA,EAEA,QAAQ,SAAsC;AAC5C,SAAK,SAAS,KAAK,OAAO;AAAA,EAC5B;AAAA;AAAA,EAGA,MAAM,mBAAmB,YAAmC;AAAA,EAE5D;AACF;;;ACvBO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAAoB,SAA4B;AAA5B;AAAA,EAA6B;AAAA,EAA7B;AAAA;AAAA,EAGpB,MAAM,aACJ,YACA,UACe;AAAA,EAEjB;AAAA;AAAA,EAGA,MAAM,eAAmC;AAEvC,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yesod/openclaw",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/eryv-ai/yesod.git",
|
|
7
|
+
"directory": "packages/openclaw"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.cjs",
|
|
17
|
+
"module": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": ["dist"],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"dev": "tsup --watch",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"clean": "rm -rf dist"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@yesod/core": "workspace:*"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"tsup": "^8.4.0",
|
|
34
|
+
"typescript": "^5.8.0",
|
|
35
|
+
"vitest": "^3.1.0"
|
|
36
|
+
}
|
|
37
|
+
}
|