@clawroom/openclaw 0.5.25 → 0.5.27
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/node_modules/@clawroom/protocol/dist/index.d.ts +759 -0
- package/node_modules/@clawroom/protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@clawroom/protocol/dist/index.js +179 -0
- package/node_modules/@clawroom/protocol/dist/index.js.map +1 -0
- package/node_modules/@clawroom/protocol/package.json +15 -4
- package/node_modules/@clawroom/sdk/dist/client.d.ts +87 -0
- package/node_modules/@clawroom/sdk/dist/client.d.ts.map +1 -0
- package/node_modules/@clawroom/sdk/dist/client.js +375 -0
- package/node_modules/@clawroom/sdk/dist/client.js.map +1 -0
- package/node_modules/@clawroom/sdk/{src/index.ts → dist/index.d.ts} +2 -16
- package/node_modules/@clawroom/sdk/dist/index.d.ts.map +1 -0
- package/node_modules/@clawroom/sdk/dist/index.js +4 -0
- package/node_modules/@clawroom/sdk/dist/index.js.map +1 -0
- package/node_modules/@clawroom/sdk/dist/machine-client.d.ts +78 -0
- package/node_modules/@clawroom/sdk/dist/machine-client.d.ts.map +1 -0
- package/node_modules/@clawroom/sdk/dist/machine-client.js +297 -0
- package/node_modules/@clawroom/sdk/dist/machine-client.js.map +1 -0
- package/node_modules/@clawroom/sdk/dist/protocol.d.ts +3 -0
- package/node_modules/@clawroom/sdk/dist/protocol.d.ts.map +1 -0
- package/node_modules/@clawroom/sdk/dist/protocol.js +2 -0
- package/node_modules/@clawroom/sdk/dist/protocol.js.map +1 -0
- package/node_modules/@clawroom/sdk/dist/ws-transport.d.ts +48 -0
- package/node_modules/@clawroom/sdk/dist/ws-transport.d.ts.map +1 -0
- package/node_modules/@clawroom/sdk/dist/ws-transport.js +188 -0
- package/node_modules/@clawroom/sdk/dist/ws-transport.js.map +1 -0
- package/node_modules/@clawroom/sdk/package.json +20 -5
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +554 -0
- package/node_modules/ws/lib/websocket.js +1393 -0
- package/node_modules/ws/package.json +70 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +11 -6
- package/node_modules/@clawroom/protocol/src/index.ts +0 -407
- package/node_modules/@clawroom/sdk/src/client.ts +0 -430
- package/node_modules/@clawroom/sdk/src/machine-client.ts +0 -356
- package/node_modules/@clawroom/sdk/src/protocol.ts +0 -22
- package/node_modules/@clawroom/sdk/src/ws-transport.ts +0 -218
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ws",
|
|
3
|
+
"version": "8.20.0",
|
|
4
|
+
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"HyBi",
|
|
7
|
+
"Push",
|
|
8
|
+
"RFC-6455",
|
|
9
|
+
"WebSocket",
|
|
10
|
+
"WebSockets",
|
|
11
|
+
"real-time"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/websockets/ws",
|
|
14
|
+
"bugs": "https://github.com/websockets/ws/issues",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/websockets/ws.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"main": "index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"browser": "./browser.js",
|
|
25
|
+
"import": "./wrapper.mjs",
|
|
26
|
+
"require": "./index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"browser": "browser.js",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=10.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"browser.js",
|
|
36
|
+
"index.js",
|
|
37
|
+
"lib/*.js",
|
|
38
|
+
"wrapper.mjs"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js",
|
|
42
|
+
"integration": "mocha --throw-deprecation test/*.integration.js",
|
|
43
|
+
"lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"bufferutil": "^4.0.1",
|
|
47
|
+
"utf-8-validate": ">=5.0.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependenciesMeta": {
|
|
50
|
+
"bufferutil": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"utf-8-validate": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@eslint/js": "^10.0.1",
|
|
59
|
+
"benchmark": "^2.1.4",
|
|
60
|
+
"bufferutil": "^4.0.1",
|
|
61
|
+
"eslint": "^10.0.1",
|
|
62
|
+
"eslint-config-prettier": "^10.0.1",
|
|
63
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
64
|
+
"globals": "^17.0.0",
|
|
65
|
+
"mocha": "^8.4.0",
|
|
66
|
+
"nyc": "^15.0.0",
|
|
67
|
+
"prettier": "^3.0.0",
|
|
68
|
+
"utf-8-validate": "^6.0.0"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import createWebSocketStream from './lib/stream.js';
|
|
2
|
+
import extension from './lib/extension.js';
|
|
3
|
+
import PerMessageDeflate from './lib/permessage-deflate.js';
|
|
4
|
+
import Receiver from './lib/receiver.js';
|
|
5
|
+
import Sender from './lib/sender.js';
|
|
6
|
+
import subprotocol from './lib/subprotocol.js';
|
|
7
|
+
import WebSocket from './lib/websocket.js';
|
|
8
|
+
import WebSocketServer from './lib/websocket-server.js';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
createWebSocketStream,
|
|
12
|
+
extension,
|
|
13
|
+
PerMessageDeflate,
|
|
14
|
+
Receiver,
|
|
15
|
+
Sender,
|
|
16
|
+
subprotocol,
|
|
17
|
+
WebSocket,
|
|
18
|
+
WebSocketServer
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default WebSocket;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clawroom/openclaw",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.27",
|
|
4
4
|
"description": "OpenClaw channel plugin for ClawRoom",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,22 +14,27 @@
|
|
|
14
14
|
"plugin",
|
|
15
15
|
"agent"
|
|
16
16
|
],
|
|
17
|
+
"main": "./src/index.ts",
|
|
17
18
|
"files": [
|
|
18
19
|
"src",
|
|
19
20
|
"openclaw.plugin.json"
|
|
20
21
|
],
|
|
22
|
+
"openclaw": {
|
|
23
|
+
"extensions": [
|
|
24
|
+
"./src/index.ts"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
21
27
|
"bundleDependencies": [
|
|
22
28
|
"@clawroom/sdk"
|
|
23
29
|
],
|
|
24
30
|
"dependencies": {
|
|
25
|
-
"@clawroom/sdk": "^0.5.
|
|
31
|
+
"@clawroom/sdk": "^0.5.26"
|
|
26
32
|
},
|
|
27
33
|
"peerDependencies": {
|
|
28
34
|
"openclaw": "*"
|
|
29
35
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
]
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"typescript": "^5.7.0"
|
|
34
39
|
}
|
|
35
40
|
}
|
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const TASK_ROLE_VALUES = ["root", "child"] as const;
|
|
4
|
-
export type TaskRole = (typeof TASK_ROLE_VALUES)[number];
|
|
5
|
-
|
|
6
|
-
export const TASK_STATUS_VALUES = ["open", "in_progress", "in_review", "done", "failed"] as const;
|
|
7
|
-
export type TaskStatus = (typeof TASK_STATUS_VALUES)[number];
|
|
8
|
-
|
|
9
|
-
export const TASK_KIND_VALUES = ["work", "decision", "approval", "follow_up"] as const;
|
|
10
|
-
export type TaskKind = (typeof TASK_KIND_VALUES)[number];
|
|
11
|
-
|
|
12
|
-
export const TASK_PRIORITY_VALUES = ["urgent", "high", "normal", "low"] as const;
|
|
13
|
-
export type TaskPriority = (typeof TASK_PRIORITY_VALUES)[number];
|
|
14
|
-
|
|
15
|
-
export const TASK_BLOCKING_STATE_VALUES = ["none", "needs_human", "external"] as const;
|
|
16
|
-
export type TaskBlockingState = (typeof TASK_BLOCKING_STATE_VALUES)[number];
|
|
17
|
-
|
|
18
|
-
export const TASK_REVIEW_VERDICT_VALUES = ["approve", "revise"] as const;
|
|
19
|
-
export type TaskReviewVerdict = (typeof TASK_REVIEW_VERDICT_VALUES)[number];
|
|
20
|
-
|
|
21
|
-
export const LIST_TASK_FILTER_VALUES = ["mine", "channel", "open"] as const;
|
|
22
|
-
export type ListTasksFilter = (typeof LIST_TASK_FILTER_VALUES)[number];
|
|
23
|
-
|
|
24
|
-
export const SERVER_CHAT_WAKE_REASON_VALUES = [
|
|
25
|
-
"mention",
|
|
26
|
-
"dm",
|
|
27
|
-
"follow_through",
|
|
28
|
-
"goal_drift",
|
|
29
|
-
"trigger",
|
|
30
|
-
"broadcast",
|
|
31
|
-
"routed",
|
|
32
|
-
"coordination",
|
|
33
|
-
"review",
|
|
34
|
-
] as const;
|
|
35
|
-
export type ServerChatWakeReason = (typeof SERVER_CHAT_WAKE_REASON_VALUES)[number];
|
|
36
|
-
|
|
37
|
-
export interface TaskExecutionPlanSubtask {
|
|
38
|
-
title: string;
|
|
39
|
-
description: string;
|
|
40
|
-
suggestedAssignee: string | null;
|
|
41
|
-
blockedBy: number[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface TaskExecutionPlan {
|
|
45
|
-
summary: string;
|
|
46
|
-
subtasks: TaskExecutionPlanSubtask[];
|
|
47
|
-
confirmedAt?: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface TaskExecutionBrief {
|
|
51
|
-
goal: string;
|
|
52
|
-
doneDefinition: string;
|
|
53
|
-
plan?: TaskExecutionPlan;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const TASK_PLAN_LIMITS = {
|
|
57
|
-
minSubtasks: 1,
|
|
58
|
-
maxSubtasks: 10,
|
|
59
|
-
} as const;
|
|
60
|
-
|
|
61
|
-
export const taskRoleSchema = z.enum(TASK_ROLE_VALUES);
|
|
62
|
-
export const taskStatusSchema = z.enum(TASK_STATUS_VALUES);
|
|
63
|
-
export const taskKindSchema = z.enum(TASK_KIND_VALUES);
|
|
64
|
-
export const taskPrioritySchema = z.enum(TASK_PRIORITY_VALUES);
|
|
65
|
-
export const taskBlockingStateSchema = z.enum(TASK_BLOCKING_STATE_VALUES);
|
|
66
|
-
export const taskReviewVerdictSchema = z.enum(TASK_REVIEW_VERDICT_VALUES);
|
|
67
|
-
export const listTasksFilterSchema = z.enum(LIST_TASK_FILTER_VALUES);
|
|
68
|
-
|
|
69
|
-
export function createTaskKindSchema(zod: typeof z) {
|
|
70
|
-
return zod.enum(TASK_KIND_VALUES);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function createTaskStatusSchema(zod: typeof z) {
|
|
74
|
-
return zod.enum(TASK_STATUS_VALUES);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function createTaskPrioritySchema(zod: typeof z) {
|
|
78
|
-
return zod.enum(TASK_PRIORITY_VALUES);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function createTaskBlockingStateSchema(zod: typeof z) {
|
|
82
|
-
return zod.enum(TASK_BLOCKING_STATE_VALUES);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function createTaskReviewVerdictSchema(zod: typeof z) {
|
|
86
|
-
return zod.enum(TASK_REVIEW_VERDICT_VALUES);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export function createListTasksFilterSchema(zod: typeof z) {
|
|
90
|
-
return zod.enum(LIST_TASK_FILTER_VALUES);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function createTaskExecutionPlanSubtaskSchema(zod: typeof z) {
|
|
94
|
-
return zod.object({
|
|
95
|
-
title: zod.string(),
|
|
96
|
-
description: zod.string(),
|
|
97
|
-
suggestedAssignee: zod.string().nullable(),
|
|
98
|
-
blockedBy: zod.array(zod.number()),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function createTaskExecutionPlanSchema(zod: typeof z) {
|
|
103
|
-
return zod.object({
|
|
104
|
-
summary: zod.string(),
|
|
105
|
-
subtasks: zod.array(createTaskExecutionPlanSubtaskSchema(zod)),
|
|
106
|
-
confirmedAt: zod.number().optional(),
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export function createTaskExecutionBriefInputSchema(zod: typeof z) {
|
|
111
|
-
return zod.object({
|
|
112
|
-
goal: zod.string(),
|
|
113
|
-
doneDefinition: zod.string(),
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export function createTaskExecutionBriefSchema(zod: typeof z) {
|
|
118
|
-
return createTaskExecutionBriefInputSchema(zod).extend({
|
|
119
|
-
plan: createTaskExecutionPlanSchema(zod).optional(),
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function createTaskPlanSubtaskSchema(zod: typeof z) {
|
|
124
|
-
return zod.object({
|
|
125
|
-
title: zod.string(),
|
|
126
|
-
description: zod.string(),
|
|
127
|
-
suggestedAssignee: zod.string(),
|
|
128
|
-
blockedBy: zod.array(zod.number()).optional(),
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export const taskExecutionPlanSubtaskSchema = createTaskExecutionPlanSubtaskSchema(z);
|
|
133
|
-
export const taskExecutionPlanSchema = createTaskExecutionPlanSchema(z);
|
|
134
|
-
export const taskExecutionBriefInputSchema = createTaskExecutionBriefInputSchema(z);
|
|
135
|
-
export const taskExecutionBriefSchema = createTaskExecutionBriefSchema(z);
|
|
136
|
-
|
|
137
|
-
export const taskCoordinationPatchSchema = z.object({
|
|
138
|
-
priority: taskPrioritySchema.optional(),
|
|
139
|
-
blockingState: taskBlockingStateSchema.optional(),
|
|
140
|
-
blockingNote: z.string().nullable().optional(),
|
|
141
|
-
executionBrief: taskExecutionBriefInputSchema.optional(),
|
|
142
|
-
accepted: z.boolean().optional(),
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export const sendMessagePayloadSchema = z.object({
|
|
146
|
-
channelId: z.string().min(1),
|
|
147
|
-
content: z.string(),
|
|
148
|
-
mentionIds: z.array(z.string().min(1)).optional(),
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
export const createTaskPayloadSchema = z.object({
|
|
152
|
-
title: z.string(),
|
|
153
|
-
description: z.string(),
|
|
154
|
-
channelId: z.string().min(1).optional(),
|
|
155
|
-
assigneeName: z.string().min(1).nullable().optional(),
|
|
156
|
-
priority: taskPrioritySchema.optional(),
|
|
157
|
-
kind: taskKindSchema.optional(),
|
|
158
|
-
scheduledFor: z.number().optional(),
|
|
159
|
-
parentTaskId: z.string().min(1).nullable().optional(),
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
export const planTaskPayloadSchema = z.object({
|
|
163
|
-
taskId: z.string().min(1),
|
|
164
|
-
summary: z.string(),
|
|
165
|
-
subtasks: z.array(createTaskPlanSubtaskSchema(z).extend({
|
|
166
|
-
blockedBy: z.array(z.number().int().min(0)).optional(),
|
|
167
|
-
})).min(TASK_PLAN_LIMITS.minSubtasks).max(TASK_PLAN_LIMITS.maxSubtasks),
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
export const updateTaskCoordinationPayloadSchema = taskCoordinationPatchSchema.extend({
|
|
171
|
-
taskId: z.string().min(1),
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
export const submitTaskPayloadSchema = z.object({
|
|
175
|
-
taskId: z.string().min(1),
|
|
176
|
-
output: z.string(),
|
|
177
|
-
filePaths: z.array(z.string().min(1)).optional(),
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
export const failTaskPayloadSchema = z.object({
|
|
181
|
-
taskId: z.string().min(1),
|
|
182
|
-
reason: z.string(),
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
export const reviewTaskPayloadSchema = z.object({
|
|
186
|
-
taskId: z.string().min(1),
|
|
187
|
-
score: z.number().int().min(1).max(5),
|
|
188
|
-
verdict: taskReviewVerdictSchema,
|
|
189
|
-
feedback: z.string(),
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
export const listTasksPayloadSchema = z.object({
|
|
193
|
-
filter: listTasksFilterSchema.optional(),
|
|
194
|
-
channelId: z.string().min(1).optional(),
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
export const uploadTaskFilePayloadSchema = z.object({
|
|
198
|
-
taskId: z.string().min(1),
|
|
199
|
-
filePath: z.string().min(1),
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
export const taskExecutionBriefJsonSchema = {
|
|
203
|
-
type: "object",
|
|
204
|
-
description: "Execution brief for a root task. Both fields are required.",
|
|
205
|
-
properties: {
|
|
206
|
-
goal: { type: "string", description: "What this task aims to achieve." },
|
|
207
|
-
doneDefinition: { type: "string", description: "What 'done' looks like." },
|
|
208
|
-
},
|
|
209
|
-
required: ["goal", "doneDefinition"],
|
|
210
|
-
} as const;
|
|
211
|
-
|
|
212
|
-
export const taskPlanSubtaskJsonSchema = {
|
|
213
|
-
type: "object",
|
|
214
|
-
properties: {
|
|
215
|
-
title: { type: "string", description: "Subtask title." },
|
|
216
|
-
description: { type: "string", description: "Detailed subtask description." },
|
|
217
|
-
suggestedAssignee: { type: "string", description: "Agent name best suited for the subtask." },
|
|
218
|
-
blockedBy: {
|
|
219
|
-
type: "array",
|
|
220
|
-
description: "Indexes of prior subtasks this one depends on.",
|
|
221
|
-
items: { type: "number" },
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
required: ["title", "description", "suggestedAssignee"],
|
|
225
|
-
} as const;
|
|
226
|
-
|
|
227
|
-
export const taskPlanSubtaskSchema = createTaskPlanSubtaskSchema(z);
|
|
228
|
-
|
|
229
|
-
export const taskPlanSubtasksSchema = z.array(taskPlanSubtaskSchema)
|
|
230
|
-
.min(TASK_PLAN_LIMITS.minSubtasks)
|
|
231
|
-
.max(TASK_PLAN_LIMITS.maxSubtasks);
|
|
232
|
-
|
|
233
|
-
export interface AgentHeartbeat {
|
|
234
|
-
type: "agent.heartbeat";
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface AgentWorkRef {
|
|
238
|
-
workId: string;
|
|
239
|
-
leaseToken: string;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export interface AgentResultFile {
|
|
243
|
-
filename: string;
|
|
244
|
-
mimeType: string;
|
|
245
|
-
data: string;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
export interface AgentComplete {
|
|
249
|
-
type: "agent.complete";
|
|
250
|
-
taskId: string;
|
|
251
|
-
output: string;
|
|
252
|
-
attachments?: AgentResultFile[];
|
|
253
|
-
workRef?: AgentWorkRef;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export interface AgentProgress {
|
|
257
|
-
type: "agent.progress";
|
|
258
|
-
taskId: string;
|
|
259
|
-
message: string;
|
|
260
|
-
workRef?: AgentWorkRef;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export interface AgentFail {
|
|
264
|
-
type: "agent.fail";
|
|
265
|
-
taskId: string;
|
|
266
|
-
reason: string;
|
|
267
|
-
workRef?: AgentWorkRef;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface AgentChatReply {
|
|
271
|
-
type: "agent.chat.reply";
|
|
272
|
-
channelId: string;
|
|
273
|
-
content: string;
|
|
274
|
-
replyTo?: string;
|
|
275
|
-
workRefs?: AgentWorkRef[];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export interface AgentTyping {
|
|
279
|
-
type: "agent.typing";
|
|
280
|
-
channelId: string;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export type AgentMessage =
|
|
284
|
-
| AgentHeartbeat
|
|
285
|
-
| AgentComplete
|
|
286
|
-
| AgentProgress
|
|
287
|
-
| AgentFail
|
|
288
|
-
| AgentChatReply
|
|
289
|
-
| AgentTyping;
|
|
290
|
-
|
|
291
|
-
export interface ServerTask {
|
|
292
|
-
type: "server.task";
|
|
293
|
-
taskId: string;
|
|
294
|
-
title: string;
|
|
295
|
-
description: string;
|
|
296
|
-
input: string;
|
|
297
|
-
channelId?: string | null;
|
|
298
|
-
workId: string;
|
|
299
|
-
leaseToken: string;
|
|
300
|
-
sourceMessageId?: string | null;
|
|
301
|
-
sourceMessageContent?: string | null;
|
|
302
|
-
sourceMessageSenderName?: string | null;
|
|
303
|
-
sourceMessageAttachments?: ChatAttachmentRef[];
|
|
304
|
-
taskRole?: TaskRole;
|
|
305
|
-
assignedAgentId?: string | null;
|
|
306
|
-
assignedAgentName?: string | null;
|
|
307
|
-
executionBrief?: TaskExecutionBrief | null;
|
|
308
|
-
taskDiscussionContext?: ServerTaskDiscussionEntry[];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export interface AgentChatProfile {
|
|
312
|
-
role: string;
|
|
313
|
-
systemPrompt: string;
|
|
314
|
-
memory: string;
|
|
315
|
-
continuityPacket: string;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
export type ServerTaskExecutionBrief = TaskExecutionBrief;
|
|
319
|
-
|
|
320
|
-
export interface ServerTaskDiscussionEntry {
|
|
321
|
-
id: string;
|
|
322
|
-
senderType: string;
|
|
323
|
-
senderName: string;
|
|
324
|
-
content: string;
|
|
325
|
-
createdAt: number;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export interface ChatAttachmentRef {
|
|
329
|
-
id?: string;
|
|
330
|
-
filename: string;
|
|
331
|
-
mimeType: string;
|
|
332
|
-
byteSize?: number;
|
|
333
|
-
downloadUrl: string;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
export interface ServerMessageContextEntry {
|
|
337
|
-
id: string;
|
|
338
|
-
senderType: string;
|
|
339
|
-
senderName: string;
|
|
340
|
-
content: string;
|
|
341
|
-
createdAt: number;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export interface ChannelMemberRef {
|
|
345
|
-
id: string;
|
|
346
|
-
name: string;
|
|
347
|
-
type: string;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
export interface ServerChatMessage {
|
|
351
|
-
type: "server.chat";
|
|
352
|
-
kind: "chat_reply" | "wake";
|
|
353
|
-
workId: string;
|
|
354
|
-
leaseToken: string;
|
|
355
|
-
messageId: string;
|
|
356
|
-
channelId: string;
|
|
357
|
-
taskId?: string | null;
|
|
358
|
-
content: string;
|
|
359
|
-
attachments?: ChatAttachmentRef[];
|
|
360
|
-
isMention?: boolean;
|
|
361
|
-
wakeReason?: ServerChatWakeReason;
|
|
362
|
-
triggerReason?: string;
|
|
363
|
-
agentProfile: AgentChatProfile;
|
|
364
|
-
context: ServerMessageContextEntry[];
|
|
365
|
-
replyToMessageId?: string | null;
|
|
366
|
-
senderName?: string;
|
|
367
|
-
senderType?: string;
|
|
368
|
-
createdAt?: number;
|
|
369
|
-
channelMembers?: ChannelMemberRef[];
|
|
370
|
-
taskTitle?: string | null;
|
|
371
|
-
taskRole?: TaskRole;
|
|
372
|
-
assignedAgentId?: string | null;
|
|
373
|
-
assignedAgentName?: string | null;
|
|
374
|
-
executionBrief?: TaskExecutionBrief | null;
|
|
375
|
-
taskDiscussionContext?: ServerTaskDiscussionEntry[];
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
export type ServerMessage = ServerTask | ServerChatMessage;
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Runtime definitions — shared between bridge, server, and UI.
|
|
382
|
-
*
|
|
383
|
-
* bridgeManaged = true: executed by bridge daemon (spawns CLI process, messages via /api/bridge/poll)
|
|
384
|
-
* bridgeManaged = false: executed by something else (e.g. OpenClaw plugin, messages via /api/machines/poll)
|
|
385
|
-
*/
|
|
386
|
-
export interface RuntimeDef {
|
|
387
|
-
id: string;
|
|
388
|
-
displayName: string;
|
|
389
|
-
/** CLI binary name to detect on PATH (empty = not detectable) */
|
|
390
|
-
binary: string;
|
|
391
|
-
/** Whether the bridge daemon spawns and manages a CLI process for this runtime */
|
|
392
|
-
bridgeManaged: boolean;
|
|
393
|
-
/** Badge color for UI */
|
|
394
|
-
badgeColor: string;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
export const RUNTIMES: RuntimeDef[] = [
|
|
398
|
-
{ id: "claude-code", displayName: "Claude Code", binary: "claude", bridgeManaged: true, badgeColor: "bg-[#7c5cbf] text-white" },
|
|
399
|
-
{ id: "codex", displayName: "Codex", binary: "codex", bridgeManaged: true, badgeColor: "bg-[#2ea043] text-white" },
|
|
400
|
-
{ id: "qwen-code", displayName: "Qwen Code", binary: "qwen", bridgeManaged: true, badgeColor: "bg-[#1a73e8] text-white" },
|
|
401
|
-
{ id: "kimi", displayName: "Kimi", binary: "kimi", bridgeManaged: true, badgeColor: "bg-[#ff6b35] text-white" },
|
|
402
|
-
{ id: "openclaw", displayName: "OpenClaw", binary: "", bridgeManaged: false, badgeColor: "bg-[var(--color-border)] text-[var(--color-text-secondary)]" },
|
|
403
|
-
];
|
|
404
|
-
|
|
405
|
-
/** Bridge-managed runtimes: server skips dequeue in /api/machines/poll (they use /api/bridge/poll instead) */
|
|
406
|
-
export const BRIDGE_MANAGED_RUNTIME_IDS = new Set(RUNTIMES.filter((r) => r.bridgeManaged).map((r) => r.id));
|
|
407
|
-
export const RUNTIME_MAP = new Map(RUNTIMES.map((r) => [r.id, r]));
|