claw-control-center 0.1.15 → 0.1.16
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/codebuddy-channel-V1mCQ7AD.d.cts +219 -0
- package/dist/codebuddy-channel.cjs +20874 -0
- package/dist/codebuddy-channel.d.cts +2 -0
- package/dist/index.cjs +25979 -6933
- package/dist/index.d.cts +71 -2
- package/dist/install-qclaw.cjs +310 -14
- package/dist/install-qclaw.d.cts +17 -2
- package/dist/workbuddy-supervisor.cjs +16152 -0
- package/dist/workbuddy-supervisor.d.cts +140 -0
- package/package.json +1 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
|
|
3
|
+
type Hub53AIBaseConfig = {
|
|
4
|
+
botId: string;
|
|
5
|
+
secret: string;
|
|
6
|
+
wsUrl: string;
|
|
7
|
+
accessPolicy: "open" | "allowlist";
|
|
8
|
+
allowFrom: string[];
|
|
9
|
+
sendThinkingMessage: boolean;
|
|
10
|
+
};
|
|
11
|
+
type Hub53AIIncomingMessage = {
|
|
12
|
+
type: string;
|
|
13
|
+
msgId: string;
|
|
14
|
+
reqId: string;
|
|
15
|
+
chatId: string;
|
|
16
|
+
userId: string;
|
|
17
|
+
userName?: string;
|
|
18
|
+
text: string;
|
|
19
|
+
imageUrls?: string[];
|
|
20
|
+
fileUrls?: string[];
|
|
21
|
+
quoteContent?: string;
|
|
22
|
+
conversationTitle?: string;
|
|
23
|
+
};
|
|
24
|
+
type Hub53AIOutgoingChunk = {
|
|
25
|
+
req_id: string;
|
|
26
|
+
action: "chat";
|
|
27
|
+
status: "streaming" | "thinking" | "done" | "error";
|
|
28
|
+
data: {
|
|
29
|
+
id: string;
|
|
30
|
+
object: "chat.completion.chunk";
|
|
31
|
+
created: number;
|
|
32
|
+
model: "openclaw-agent";
|
|
33
|
+
status?: "streaming" | "thinking" | "done" | "error";
|
|
34
|
+
mode?: string;
|
|
35
|
+
replace?: boolean;
|
|
36
|
+
event_kind?: string;
|
|
37
|
+
payload?: Record<string, unknown>;
|
|
38
|
+
session_id?: string;
|
|
39
|
+
conversation_id?: string;
|
|
40
|
+
choices: Array<{
|
|
41
|
+
index: number;
|
|
42
|
+
delta: {
|
|
43
|
+
content: string;
|
|
44
|
+
role: "assistant";
|
|
45
|
+
};
|
|
46
|
+
finish_reason: "stop" | "error" | null;
|
|
47
|
+
}>;
|
|
48
|
+
error?: {
|
|
49
|
+
code: string;
|
|
50
|
+
message: string;
|
|
51
|
+
details?: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
declare function parseIncomingMessage(rawJson: string): Hub53AIIncomingMessage | null;
|
|
56
|
+
declare function buildHub53AIPrompt(message: Hub53AIIncomingMessage): string;
|
|
57
|
+
declare function buildHub53AIOutgoingChunk(reqId: string, text: string, status: Hub53AIOutgoingChunk["status"], error?: Hub53AIOutgoingChunk["data"]["error"], sessionId?: string, metadata?: {
|
|
58
|
+
mode?: string;
|
|
59
|
+
replace?: boolean;
|
|
60
|
+
eventKind?: string;
|
|
61
|
+
payload?: Record<string, unknown>;
|
|
62
|
+
}): Hub53AIOutgoingChunk;
|
|
63
|
+
declare function createHub53AIAuthHeaders(config: Pick<Hub53AIBaseConfig, "botId" | "secret">): Record<string, string>;
|
|
64
|
+
declare function checkHub53AIAccessPolicy(config: Pick<Hub53AIBaseConfig, "accessPolicy" | "allowFrom">, message: Hub53AIIncomingMessage): {
|
|
65
|
+
allowed: boolean;
|
|
66
|
+
reason: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type WorkBuddyHistoryMessage = {
|
|
70
|
+
id: string;
|
|
71
|
+
sessionId: string;
|
|
72
|
+
role: "user" | "assistant";
|
|
73
|
+
content: string;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
};
|
|
76
|
+
type WorkBuddyHistorySession = {
|
|
77
|
+
id: string;
|
|
78
|
+
title: string;
|
|
79
|
+
status: "idle" | "running" | "completed" | "stopped";
|
|
80
|
+
hostKind: "workbuddy";
|
|
81
|
+
runnerCommand: "workbuddy";
|
|
82
|
+
createdAt: string;
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
lastEventSeq: number;
|
|
85
|
+
cwd?: string;
|
|
86
|
+
source?: "jsonl" | "sqlite";
|
|
87
|
+
};
|
|
88
|
+
type WorkBuddyHistorySnapshot = {
|
|
89
|
+
sessions: WorkBuddyHistorySession[];
|
|
90
|
+
messagesBySessionId: Map<string, WorkBuddyHistoryMessage[]>;
|
|
91
|
+
};
|
|
92
|
+
type LoadWorkBuddyHistoryInput = {
|
|
93
|
+
workbuddyHome?: string;
|
|
94
|
+
sqliteCommand?: string;
|
|
95
|
+
};
|
|
96
|
+
declare function loadWorkBuddyHistory(input?: LoadWorkBuddyHistoryInput): Promise<WorkBuddyHistorySnapshot>;
|
|
97
|
+
|
|
98
|
+
type Hub53AIChannelConfig = Hub53AIBaseConfig & {
|
|
99
|
+
reconnectBaseMs: number;
|
|
100
|
+
maxReconnectAttempts: number;
|
|
101
|
+
workbuddyHome: string;
|
|
102
|
+
workbuddyHistoryScope: "all" | "channel";
|
|
103
|
+
workbuddySessionId: string;
|
|
104
|
+
};
|
|
105
|
+
type Hub53AIChannelStatusSnapshot = {
|
|
106
|
+
configured: boolean;
|
|
107
|
+
connectionStatus: "connecting" | "connected" | "disconnected" | "error";
|
|
108
|
+
botId?: string;
|
|
109
|
+
wsUrl?: string;
|
|
110
|
+
lastHeartbeatAt?: string;
|
|
111
|
+
lastConnectedAt?: string;
|
|
112
|
+
lastError?: string;
|
|
113
|
+
receivedMessageCount: number;
|
|
114
|
+
sentMessageCount: number;
|
|
115
|
+
pendingOutboundCount: number;
|
|
116
|
+
knownChatCount: number;
|
|
117
|
+
};
|
|
118
|
+
type CodeBuddyChannelNotification = {
|
|
119
|
+
content: string;
|
|
120
|
+
meta: Record<string, string>;
|
|
121
|
+
};
|
|
122
|
+
type CodeBuddyChannelBridgeInput = {
|
|
123
|
+
config: Hub53AIChannelConfig;
|
|
124
|
+
notifyChannel(notification: CodeBuddyChannelNotification): Promise<void>;
|
|
125
|
+
historyLoader?: () => Promise<WorkBuddyHistorySnapshot>;
|
|
126
|
+
logger?: {
|
|
127
|
+
info?(message: string): void;
|
|
128
|
+
warn?(message: string): void;
|
|
129
|
+
error?(message: string): void;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
type CodeBuddyChannelBroker = {
|
|
133
|
+
role: "leader" | "follower";
|
|
134
|
+
requestReply(input: {
|
|
135
|
+
chatId: string;
|
|
136
|
+
text: string;
|
|
137
|
+
reqId?: string;
|
|
138
|
+
}): Promise<void>;
|
|
139
|
+
requestStatus(): Promise<unknown>;
|
|
140
|
+
close(): Promise<void>;
|
|
141
|
+
};
|
|
142
|
+
declare function createCodeBuddyChannelBridge(input: CodeBuddyChannelBridgeInput): {
|
|
143
|
+
start: () => Promise<void>;
|
|
144
|
+
stop: () => Promise<void>;
|
|
145
|
+
reply: (inputReply: {
|
|
146
|
+
chatId: string;
|
|
147
|
+
text: string;
|
|
148
|
+
reqId?: string;
|
|
149
|
+
status?: Hub53AIOutgoingChunk["status"];
|
|
150
|
+
}) => Promise<void>;
|
|
151
|
+
getStatus: () => Hub53AIChannelStatusSnapshot;
|
|
152
|
+
};
|
|
153
|
+
declare function resolveCodeBuddyChannelBrokerSocketPath(config: Hub53AIChannelConfig): string;
|
|
154
|
+
declare function createCodeBuddyChannelBroker(input: {
|
|
155
|
+
socketPath: string;
|
|
156
|
+
handlers: {
|
|
157
|
+
reply(reply: {
|
|
158
|
+
chatId: string;
|
|
159
|
+
text: string;
|
|
160
|
+
reqId?: string;
|
|
161
|
+
}): Promise<void>;
|
|
162
|
+
status(): unknown;
|
|
163
|
+
};
|
|
164
|
+
logger?: CodeBuddyChannelBridgeInput["logger"];
|
|
165
|
+
}): Promise<CodeBuddyChannelBroker>;
|
|
166
|
+
declare function loadCodeBuddyChannelConfig(env?: NodeJS.ProcessEnv): Hub53AIChannelConfig;
|
|
167
|
+
declare function startCodeBuddyChannelServer(input?: {
|
|
168
|
+
config?: Hub53AIChannelConfig;
|
|
169
|
+
logger?: CodeBuddyChannelBridgeInput["logger"];
|
|
170
|
+
}): Promise<{
|
|
171
|
+
mcp: Server<{
|
|
172
|
+
method: string;
|
|
173
|
+
params?: {
|
|
174
|
+
[x: string]: unknown;
|
|
175
|
+
_meta?: {
|
|
176
|
+
[x: string]: unknown;
|
|
177
|
+
progressToken?: string | number | undefined;
|
|
178
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
179
|
+
taskId: string;
|
|
180
|
+
} | undefined;
|
|
181
|
+
} | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
method: string;
|
|
185
|
+
params?: {
|
|
186
|
+
[x: string]: unknown;
|
|
187
|
+
_meta?: {
|
|
188
|
+
[x: string]: unknown;
|
|
189
|
+
progressToken?: string | number | undefined;
|
|
190
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
191
|
+
taskId: string;
|
|
192
|
+
} | undefined;
|
|
193
|
+
} | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
[x: string]: unknown;
|
|
197
|
+
_meta?: {
|
|
198
|
+
[x: string]: unknown;
|
|
199
|
+
progressToken?: string | number | undefined;
|
|
200
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
201
|
+
taskId: string;
|
|
202
|
+
} | undefined;
|
|
203
|
+
} | undefined;
|
|
204
|
+
}>;
|
|
205
|
+
bridge: {
|
|
206
|
+
start: () => Promise<void>;
|
|
207
|
+
stop: () => Promise<void>;
|
|
208
|
+
reply: (inputReply: {
|
|
209
|
+
chatId: string;
|
|
210
|
+
text: string;
|
|
211
|
+
reqId?: string;
|
|
212
|
+
status?: Hub53AIOutgoingChunk["status"];
|
|
213
|
+
}) => Promise<void>;
|
|
214
|
+
getStatus: () => Hub53AIChannelStatusSnapshot;
|
|
215
|
+
};
|
|
216
|
+
stop: () => Promise<void>;
|
|
217
|
+
}>;
|
|
218
|
+
|
|
219
|
+
export { type CodeBuddyChannelBridgeInput as C, type Hub53AIBaseConfig as H, type WorkBuddyHistoryMessage as W, type CodeBuddyChannelBroker as a, type CodeBuddyChannelNotification as b, type Hub53AIChannelConfig as c, type Hub53AIChannelStatusSnapshot as d, type WorkBuddyHistorySession as e, type WorkBuddyHistorySnapshot as f, buildHub53AIOutgoingChunk as g, buildHub53AIPrompt as h, checkHub53AIAccessPolicy as i, createCodeBuddyChannelBridge as j, createCodeBuddyChannelBroker as k, createHub53AIAuthHeaders as l, loadCodeBuddyChannelConfig as m, loadWorkBuddyHistory as n, parseIncomingMessage as p, resolveCodeBuddyChannelBrokerSocketPath as r, startCodeBuddyChannelServer as s };
|