@mclawnet/shared 0.1.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/constants.d.ts +27 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +29 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol/agent.d.ts +231 -0
- package/dist/protocol/agent.d.ts.map +1 -0
- package/dist/protocol/agent.js +4 -0
- package/dist/protocol/agent.js.map +1 -0
- package/dist/protocol/chat.d.ts +207 -0
- package/dist/protocol/chat.d.ts.map +1 -0
- package/dist/protocol/chat.js +4 -0
- package/dist/protocol/chat.js.map +1 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +2 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/proxy.d.ts +20 -0
- package/dist/protocol/proxy.d.ts.map +1 -0
- package/dist/protocol/proxy.js +6 -0
- package/dist/protocol/proxy.js.map +1 -0
- package/dist/schemas.d.ts +89 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +38 -0
- package/dist/schemas.js.map +1 -0
- package/dist/types/agent.d.ts +24 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +2 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/message.d.ts +13 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/message.js +2 -0
- package/dist/types/message.js.map +1 -0
- package/dist/types/session.d.ts +17 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +2 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/user.d.ts +21 -0
- package/dist/types/user.d.ts.map +1 -0
- package/dist/types/user.js +2 -0
- package/dist/types/user.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Auth timeout in ms — agent must authenticate within this window */
|
|
2
|
+
export declare const AUTH_TIMEOUT_MS = 10000;
|
|
3
|
+
/** Heartbeat interval in ms — agent sends heartbeat on this cadence */
|
|
4
|
+
export declare const HEARTBEAT_INTERVAL_MS = 30000;
|
|
5
|
+
/** Default reconnect delay in ms */
|
|
6
|
+
export declare const DEFAULT_RECONNECT_MS = 1000;
|
|
7
|
+
/** Max reconnect delay in ms (exponential backoff cap) */
|
|
8
|
+
export declare const MAX_RECONNECT_MS = 30000;
|
|
9
|
+
/** Agent sent invalid token */
|
|
10
|
+
export declare const WS_CLOSE_INVALID_TOKEN = 4002;
|
|
11
|
+
/** Agent auth timed out */
|
|
12
|
+
export declare const WS_CLOSE_AUTH_TIMEOUT = 4003;
|
|
13
|
+
/** Invalid JSON or unexpected message */
|
|
14
|
+
export declare const WS_CLOSE_INVALID_MESSAGE = 4004;
|
|
15
|
+
/** Server shutting down */
|
|
16
|
+
export declare const WS_CLOSE_SERVER_SHUTDOWN = 4005;
|
|
17
|
+
export declare const BACKEND_TYPES: readonly ["claude-code", "openclaw", "codex"];
|
|
18
|
+
export type BackendType = (typeof BACKEND_TYPES)[number];
|
|
19
|
+
export declare const USER_ROLES: readonly ["admin", "user"];
|
|
20
|
+
export type UserRole = (typeof USER_ROLES)[number];
|
|
21
|
+
export declare const MESSAGE_ROLES: readonly ["user", "assistant", "system"];
|
|
22
|
+
export type MessageRole = (typeof MESSAGE_ROLES)[number];
|
|
23
|
+
export declare const MESSAGE_TYPES: readonly ["text", "tool_use", "tool_result", "thinking", "route"];
|
|
24
|
+
export type MessageType = (typeof MESSAGE_TYPES)[number];
|
|
25
|
+
export declare const AGENT_STATUSES: readonly ["online", "offline"];
|
|
26
|
+
export type AgentStatus = (typeof AGENT_STATUSES)[number];
|
|
27
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,oCAAoC;AACpC,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAE1C,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAIvC,+BAA+B;AAC/B,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,2BAA2B;AAC3B,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,yCAAyC;AACzC,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,2BAA2B;AAC3B,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAI7C,eAAO,MAAM,aAAa,+CAAgD,CAAC;AAC3E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAIzD,eAAO,MAAM,UAAU,4BAA6B,CAAC;AACrD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAInD,eAAO,MAAM,aAAa,0CAA2C,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAIzD,eAAO,MAAM,aAAa,mEAAoE,CAAC;AAC/F,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAIzD,eAAO,MAAM,cAAc,gCAAiC,CAAC;AAC7D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// ── Constants ────────────────────────────────────────────────────────
|
|
2
|
+
/** Auth timeout in ms — agent must authenticate within this window */
|
|
3
|
+
export const AUTH_TIMEOUT_MS = 10_000;
|
|
4
|
+
/** Heartbeat interval in ms — agent sends heartbeat on this cadence */
|
|
5
|
+
export const HEARTBEAT_INTERVAL_MS = 30_000;
|
|
6
|
+
/** Default reconnect delay in ms */
|
|
7
|
+
export const DEFAULT_RECONNECT_MS = 1_000;
|
|
8
|
+
/** Max reconnect delay in ms (exponential backoff cap) */
|
|
9
|
+
export const MAX_RECONNECT_MS = 30_000;
|
|
10
|
+
// ── WebSocket Close Codes ────────────────────────────────────────────
|
|
11
|
+
/** Agent sent invalid token */
|
|
12
|
+
export const WS_CLOSE_INVALID_TOKEN = 4002;
|
|
13
|
+
/** Agent auth timed out */
|
|
14
|
+
export const WS_CLOSE_AUTH_TIMEOUT = 4003;
|
|
15
|
+
/** Invalid JSON or unexpected message */
|
|
16
|
+
export const WS_CLOSE_INVALID_MESSAGE = 4004;
|
|
17
|
+
/** Server shutting down */
|
|
18
|
+
export const WS_CLOSE_SERVER_SHUTDOWN = 4005;
|
|
19
|
+
// ── Backend Types ────────────────────────────────────────────────────
|
|
20
|
+
export const BACKEND_TYPES = ["claude-code", "openclaw", "codex"];
|
|
21
|
+
// ── User Roles ───────────────────────────────────────────────────────
|
|
22
|
+
export const USER_ROLES = ["admin", "user"];
|
|
23
|
+
// ── Message Roles ────────────────────────────────────────────────────
|
|
24
|
+
export const MESSAGE_ROLES = ["user", "assistant", "system"];
|
|
25
|
+
// ── Message Types ────────────────────────────────────────────────────
|
|
26
|
+
export const MESSAGE_TYPES = ["text", "tool_use", "tool_result", "thinking", "route"];
|
|
27
|
+
// ── Agent Status ─────────────────────────────────────────────────────
|
|
28
|
+
export const AGENT_STATUSES = ["online", "offline"];
|
|
29
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,wEAAwE;AAExE,sEAAsE;AACtE,M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Ac,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAEvE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
export interface AgentAuthRequired {
|
|
2
|
+
type: "auth_required";
|
|
3
|
+
}
|
|
4
|
+
export interface AgentRegistered {
|
|
5
|
+
type: "registered";
|
|
6
|
+
agentId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentAck {
|
|
9
|
+
type: "ack";
|
|
10
|
+
ts: number;
|
|
11
|
+
}
|
|
12
|
+
export interface AgentSessionCreate {
|
|
13
|
+
type: "session.create";
|
|
14
|
+
sessionId: string;
|
|
15
|
+
workDir?: string;
|
|
16
|
+
resumeId?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AgentSessionClose {
|
|
19
|
+
type: "session.close";
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AgentClaudeInput {
|
|
23
|
+
type: "claude.input";
|
|
24
|
+
sessionId: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Combined create+input: Hub tells agent to execute a prompt in a session.
|
|
29
|
+
* Agent auto-creates the Claude CLI process if it doesn't exist yet (lazy start).
|
|
30
|
+
*/
|
|
31
|
+
export interface AgentClaudeExecute {
|
|
32
|
+
type: "claude.execute";
|
|
33
|
+
sessionId: string;
|
|
34
|
+
content: string;
|
|
35
|
+
workDir?: string;
|
|
36
|
+
claudeSessionId?: string;
|
|
37
|
+
useBrainCore?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface AgentFsListDir {
|
|
40
|
+
type: "fs.list_dir";
|
|
41
|
+
requestId: string;
|
|
42
|
+
path: string;
|
|
43
|
+
}
|
|
44
|
+
export interface AgentListFolders {
|
|
45
|
+
type: "list_folders";
|
|
46
|
+
requestId: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AgentListHistorySessions {
|
|
49
|
+
type: "list_history_sessions";
|
|
50
|
+
requestId: string;
|
|
51
|
+
workDir: string;
|
|
52
|
+
}
|
|
53
|
+
export interface AgentLoadSessionHistory {
|
|
54
|
+
type: "load_session_history";
|
|
55
|
+
requestId: string;
|
|
56
|
+
workDir: string;
|
|
57
|
+
claudeSessionId: string;
|
|
58
|
+
}
|
|
59
|
+
export interface AgentProxyOpen {
|
|
60
|
+
type: "proxy.open";
|
|
61
|
+
sessionId: string;
|
|
62
|
+
gatewayPort: number;
|
|
63
|
+
}
|
|
64
|
+
export interface AgentProxyData {
|
|
65
|
+
type: "proxy.data";
|
|
66
|
+
sessionId: string;
|
|
67
|
+
data: string;
|
|
68
|
+
}
|
|
69
|
+
export interface AgentProxyClose {
|
|
70
|
+
type: "proxy.close";
|
|
71
|
+
sessionId: string;
|
|
72
|
+
}
|
|
73
|
+
export interface AgentSwarmExecute {
|
|
74
|
+
type: "swarm.execute";
|
|
75
|
+
sessionId: string;
|
|
76
|
+
content: string;
|
|
77
|
+
workDir?: string;
|
|
78
|
+
targetInstance?: string;
|
|
79
|
+
crewConfig?: {
|
|
80
|
+
roles: Array<{
|
|
81
|
+
roleName: string;
|
|
82
|
+
count?: number;
|
|
83
|
+
customPrompt?: string;
|
|
84
|
+
customDefinition?: {
|
|
85
|
+
name: string;
|
|
86
|
+
shortName: string;
|
|
87
|
+
description: string;
|
|
88
|
+
capabilities: string[];
|
|
89
|
+
color: string;
|
|
90
|
+
promptBody: string;
|
|
91
|
+
};
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export interface AgentListRoles {
|
|
96
|
+
type: "list_roles";
|
|
97
|
+
sessionId: string;
|
|
98
|
+
}
|
|
99
|
+
export interface AgentAbortExecution {
|
|
100
|
+
type: "abort_execution";
|
|
101
|
+
sessionId: string;
|
|
102
|
+
}
|
|
103
|
+
export type AgentServerMessage = AgentAuthRequired | AgentRegistered | AgentAck | AgentSessionCreate | AgentSessionClose | AgentClaudeInput | AgentClaudeExecute | AgentFsListDir | AgentListFolders | AgentListHistorySessions | AgentLoadSessionHistory | AgentProxyOpen | AgentProxyData | AgentProxyClose | AgentSwarmExecute | AgentListRoles | AgentAbortExecution;
|
|
104
|
+
export interface AgentAuth {
|
|
105
|
+
type: "auth";
|
|
106
|
+
token: string;
|
|
107
|
+
hostname: string;
|
|
108
|
+
version?: string;
|
|
109
|
+
capabilities?: string[];
|
|
110
|
+
}
|
|
111
|
+
export interface AgentHeartbeat {
|
|
112
|
+
type: "heartbeat";
|
|
113
|
+
ts: number;
|
|
114
|
+
}
|
|
115
|
+
export interface AgentSessionCreated {
|
|
116
|
+
type: "session.created";
|
|
117
|
+
sessionId: string;
|
|
118
|
+
claudeSessionId: string;
|
|
119
|
+
}
|
|
120
|
+
export interface AgentSessionError {
|
|
121
|
+
type: "session.error";
|
|
122
|
+
sessionId: string;
|
|
123
|
+
error: string;
|
|
124
|
+
}
|
|
125
|
+
export interface AgentClaudeOutput {
|
|
126
|
+
type: "claude.output";
|
|
127
|
+
sessionId: string;
|
|
128
|
+
data: unknown;
|
|
129
|
+
}
|
|
130
|
+
export interface AgentClaudeTurnComplete {
|
|
131
|
+
type: "claude.turn_complete";
|
|
132
|
+
sessionId: string;
|
|
133
|
+
cost?: number;
|
|
134
|
+
duration?: number;
|
|
135
|
+
contextUsage?: {
|
|
136
|
+
used: number;
|
|
137
|
+
total: number;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export interface AgentFsListDirResult {
|
|
141
|
+
type: "fs.list_dir_result";
|
|
142
|
+
requestId: string;
|
|
143
|
+
path: string;
|
|
144
|
+
entries: Array<{
|
|
145
|
+
name: string;
|
|
146
|
+
type: "directory" | "file";
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
export interface AgentFoldersListResult {
|
|
150
|
+
type: "folders_list_result";
|
|
151
|
+
requestId: string;
|
|
152
|
+
folders: Array<{
|
|
153
|
+
path: string;
|
|
154
|
+
sessionCount: number;
|
|
155
|
+
lastModified?: number;
|
|
156
|
+
}>;
|
|
157
|
+
}
|
|
158
|
+
export interface AgentHistorySessionsResult {
|
|
159
|
+
type: "history_sessions_result";
|
|
160
|
+
requestId: string;
|
|
161
|
+
workDir: string;
|
|
162
|
+
sessions: Array<{
|
|
163
|
+
sessionId: string;
|
|
164
|
+
title: string;
|
|
165
|
+
workDir?: string;
|
|
166
|
+
lastModified?: number;
|
|
167
|
+
}>;
|
|
168
|
+
}
|
|
169
|
+
export interface HistoryMessage {
|
|
170
|
+
role: "user" | "assistant";
|
|
171
|
+
content: string;
|
|
172
|
+
toolCalls?: Array<{
|
|
173
|
+
name: string;
|
|
174
|
+
input?: string;
|
|
175
|
+
output?: string;
|
|
176
|
+
status: string;
|
|
177
|
+
}>;
|
|
178
|
+
thinking?: string;
|
|
179
|
+
}
|
|
180
|
+
export interface AgentSessionHistoryResult {
|
|
181
|
+
type: "session_history_result";
|
|
182
|
+
requestId: string;
|
|
183
|
+
messages: HistoryMessage[];
|
|
184
|
+
}
|
|
185
|
+
export interface AgentProxyOpened {
|
|
186
|
+
type: "proxy.opened";
|
|
187
|
+
sessionId: string;
|
|
188
|
+
}
|
|
189
|
+
export interface AgentSwarmOutput {
|
|
190
|
+
type: "swarm.output";
|
|
191
|
+
sessionId: string;
|
|
192
|
+
instanceId: string;
|
|
193
|
+
roleName: string;
|
|
194
|
+
data: unknown;
|
|
195
|
+
}
|
|
196
|
+
export interface AgentSwarmTurnComplete {
|
|
197
|
+
type: "swarm.turn_complete";
|
|
198
|
+
sessionId: string;
|
|
199
|
+
instanceId: string;
|
|
200
|
+
roleName: string;
|
|
201
|
+
cost?: number;
|
|
202
|
+
duration?: number;
|
|
203
|
+
}
|
|
204
|
+
export interface AgentSwarmStatus {
|
|
205
|
+
type: "swarm.status";
|
|
206
|
+
sessionId: string;
|
|
207
|
+
roles: Array<{
|
|
208
|
+
instanceId: string;
|
|
209
|
+
roleName: string;
|
|
210
|
+
status: string;
|
|
211
|
+
currentTask?: string;
|
|
212
|
+
color?: string;
|
|
213
|
+
}>;
|
|
214
|
+
plan?: unknown;
|
|
215
|
+
}
|
|
216
|
+
export interface AgentRolesListResult {
|
|
217
|
+
type: "roles_list_result";
|
|
218
|
+
sessionId: string;
|
|
219
|
+
roles: Array<{
|
|
220
|
+
name: string;
|
|
221
|
+
displayName: string;
|
|
222
|
+
description: string;
|
|
223
|
+
capabilities: string[];
|
|
224
|
+
}>;
|
|
225
|
+
}
|
|
226
|
+
export interface AgentExecutionAborted {
|
|
227
|
+
type: "execution_aborted";
|
|
228
|
+
sessionId: string;
|
|
229
|
+
}
|
|
230
|
+
export type AgentClientMessage = AgentAuth | AgentHeartbeat | AgentSessionCreated | AgentSessionError | AgentClaudeOutput | AgentClaudeTurnComplete | AgentFsListDirResult | AgentFoldersListResult | AgentHistorySessionsResult | AgentSessionHistoryResult | AgentProxyOpened | AgentProxyData | AgentProxyClose | AgentSwarmOutput | AgentSwarmTurnComplete | AgentSwarmStatus | AgentRolesListResult | AgentExecutionAborted;
|
|
231
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/protocol/agent.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAA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ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,uEAAuE"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export interface ChatAuth {
|
|
2
|
+
type: "auth";
|
|
3
|
+
token: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ChatCreateConversation {
|
|
6
|
+
type: "create_conversation";
|
|
7
|
+
agentId?: string;
|
|
8
|
+
workDir?: string;
|
|
9
|
+
claudeSessionId?: string;
|
|
10
|
+
useBrainCore?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ChatSendMessage {
|
|
13
|
+
type: "send_message";
|
|
14
|
+
sessionId: string;
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ChatListDirectory {
|
|
18
|
+
type: "list_directory";
|
|
19
|
+
agentId: string;
|
|
20
|
+
path: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ChatListFolders {
|
|
23
|
+
type: "list_folders";
|
|
24
|
+
agentId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ChatListHistorySessions {
|
|
27
|
+
type: "list_history_sessions";
|
|
28
|
+
agentId: string;
|
|
29
|
+
workDir: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ChatLoadSessionHistory {
|
|
32
|
+
type: "load_session_history";
|
|
33
|
+
agentId: string;
|
|
34
|
+
workDir: string;
|
|
35
|
+
claudeSessionId: string;
|
|
36
|
+
}
|
|
37
|
+
/** Inline definition for a custom role not on the agent's disk. */
|
|
38
|
+
export interface CustomRoleDefinition {
|
|
39
|
+
name: string;
|
|
40
|
+
shortName: string;
|
|
41
|
+
description: string;
|
|
42
|
+
capabilities: string[];
|
|
43
|
+
color: string;
|
|
44
|
+
promptBody: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ChatCreateSwarmConversation {
|
|
47
|
+
type: "create_swarm_conversation";
|
|
48
|
+
agentId?: string;
|
|
49
|
+
workDir?: string;
|
|
50
|
+
roles: Array<{
|
|
51
|
+
roleName: string;
|
|
52
|
+
count?: number;
|
|
53
|
+
customPrompt?: string;
|
|
54
|
+
customDefinition?: CustomRoleDefinition;
|
|
55
|
+
}>;
|
|
56
|
+
task?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface ChatUpgradeToSwarm {
|
|
59
|
+
type: "upgrade_to_swarm";
|
|
60
|
+
sessionId: string;
|
|
61
|
+
roles: Array<{
|
|
62
|
+
roleName: string;
|
|
63
|
+
count?: number;
|
|
64
|
+
customPrompt?: string;
|
|
65
|
+
customDefinition?: CustomRoleDefinition;
|
|
66
|
+
}>;
|
|
67
|
+
task?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface ChatListRoles {
|
|
70
|
+
type: "list_roles";
|
|
71
|
+
sessionId: string;
|
|
72
|
+
}
|
|
73
|
+
export interface ChatAbortExecution {
|
|
74
|
+
type: "abort_execution";
|
|
75
|
+
sessionId: string;
|
|
76
|
+
}
|
|
77
|
+
export interface ChatWatchSession {
|
|
78
|
+
type: "watch_session";
|
|
79
|
+
sessionId: string;
|
|
80
|
+
}
|
|
81
|
+
export type ChatClientMessage = ChatAuth | ChatCreateConversation | ChatSendMessage | ChatListDirectory | ChatListFolders | ChatListHistorySessions | ChatLoadSessionHistory | ChatCreateSwarmConversation | ChatUpgradeToSwarm | ChatListRoles | ChatAbortExecution | ChatWatchSession;
|
|
82
|
+
export interface ChatAuthResult {
|
|
83
|
+
type: "auth_result";
|
|
84
|
+
success: boolean;
|
|
85
|
+
userId?: string;
|
|
86
|
+
error?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ChatConversationCreated {
|
|
89
|
+
type: "conversation_created";
|
|
90
|
+
sessionId: string;
|
|
91
|
+
agentId: string;
|
|
92
|
+
agentName?: string;
|
|
93
|
+
workDir?: string;
|
|
94
|
+
isCrew?: boolean;
|
|
95
|
+
title?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ChatConversationError {
|
|
98
|
+
type: "conversation_error";
|
|
99
|
+
error: string;
|
|
100
|
+
}
|
|
101
|
+
export interface ChatClaudeOutput {
|
|
102
|
+
type: "claude_output";
|
|
103
|
+
sessionId: string;
|
|
104
|
+
data: unknown;
|
|
105
|
+
}
|
|
106
|
+
export interface ChatTurnCompleted {
|
|
107
|
+
type: "turn_completed";
|
|
108
|
+
sessionId: string;
|
|
109
|
+
cost?: number;
|
|
110
|
+
duration?: number;
|
|
111
|
+
}
|
|
112
|
+
export interface ChatContextUsage {
|
|
113
|
+
type: "context_usage";
|
|
114
|
+
sessionId: string;
|
|
115
|
+
used: number;
|
|
116
|
+
total: number;
|
|
117
|
+
}
|
|
118
|
+
export interface ChatDirectoryListing {
|
|
119
|
+
type: "directory_listing";
|
|
120
|
+
path: string;
|
|
121
|
+
entries: Array<{
|
|
122
|
+
name: string;
|
|
123
|
+
type: "directory" | "file";
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
export interface ChatFoldersList {
|
|
127
|
+
type: "folders_list";
|
|
128
|
+
folders: Array<{
|
|
129
|
+
path: string;
|
|
130
|
+
sessionCount: number;
|
|
131
|
+
lastModified?: number;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
export interface ChatHistorySessionsList {
|
|
135
|
+
type: "history_sessions_list";
|
|
136
|
+
workDir: string;
|
|
137
|
+
sessions: Array<{
|
|
138
|
+
sessionId: string;
|
|
139
|
+
title: string;
|
|
140
|
+
workDir?: string;
|
|
141
|
+
lastModified?: number;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
export interface ChatSessionHistory {
|
|
145
|
+
type: "session_history";
|
|
146
|
+
sessionId: string;
|
|
147
|
+
messages: Array<{
|
|
148
|
+
role: "user" | "assistant";
|
|
149
|
+
content: string;
|
|
150
|
+
toolCalls?: Array<{
|
|
151
|
+
name: string;
|
|
152
|
+
input?: string;
|
|
153
|
+
output?: string;
|
|
154
|
+
status: string;
|
|
155
|
+
}>;
|
|
156
|
+
thinking?: string;
|
|
157
|
+
}>;
|
|
158
|
+
}
|
|
159
|
+
export interface ChatError {
|
|
160
|
+
type: "error";
|
|
161
|
+
sessionId?: string;
|
|
162
|
+
error: string;
|
|
163
|
+
}
|
|
164
|
+
export interface ChatSwarmOutput {
|
|
165
|
+
type: "swarm_output";
|
|
166
|
+
sessionId: string;
|
|
167
|
+
instanceId: string;
|
|
168
|
+
roleName: string;
|
|
169
|
+
data: unknown;
|
|
170
|
+
}
|
|
171
|
+
export interface ChatSwarmTurnCompleted {
|
|
172
|
+
type: "swarm_turn_completed";
|
|
173
|
+
sessionId: string;
|
|
174
|
+
instanceId: string;
|
|
175
|
+
roleName: string;
|
|
176
|
+
cost?: number;
|
|
177
|
+
duration?: number;
|
|
178
|
+
}
|
|
179
|
+
export interface ChatSwarmStatus {
|
|
180
|
+
type: "swarm_status";
|
|
181
|
+
sessionId: string;
|
|
182
|
+
roles: Array<{
|
|
183
|
+
instanceId: string;
|
|
184
|
+
roleName: string;
|
|
185
|
+
status: string;
|
|
186
|
+
currentTask?: string;
|
|
187
|
+
color?: string;
|
|
188
|
+
}>;
|
|
189
|
+
plan?: unknown;
|
|
190
|
+
}
|
|
191
|
+
export interface ChatRolesList {
|
|
192
|
+
type: "roles_list";
|
|
193
|
+
sessionId: string;
|
|
194
|
+
roles: Array<{
|
|
195
|
+
name: string;
|
|
196
|
+
displayName: string;
|
|
197
|
+
description: string;
|
|
198
|
+
capabilities: string[];
|
|
199
|
+
promptBody?: string;
|
|
200
|
+
}>;
|
|
201
|
+
}
|
|
202
|
+
export interface ChatExecutionAborted {
|
|
203
|
+
type: "execution_aborted";
|
|
204
|
+
sessionId: string;
|
|
205
|
+
}
|
|
206
|
+
export type ChatServerMessage = ChatAuthResult | ChatConversationCreated | ChatConversationError | ChatClaudeOutput | ChatTurnCompleted | ChatContextUsage | ChatDirectoryListing | ChatFoldersList | ChatHistorySessionsList | ChatSessionHistory | ChatError | ChatSwarmOutput | ChatSwarmTurnCompleted | ChatSwarmStatus | ChatRolesList | ChatExecutionAborted;
|
|
207
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@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
|
1
|
+
export type { AgentServerMessage, AgentClientMessage, AgentAuthRequired, AgentRegistered, AgentAck, AgentSessionCreate, AgentSessionClose, AgentClaudeInput, AgentClaudeExecute, AgentFsListDir, AgentListFolders, AgentListHistorySessions, AgentListRoles, AgentAuth, AgentHeartbeat, AgentSessionCreated, AgentSessionError, AgentClaudeOutput, AgentClaudeTurnComplete, AgentFsListDirResult, AgentFoldersListResult, AgentHistorySessionsResult, AgentRolesListResult, AgentProxyOpen, AgentProxyData, AgentProxyClose, AgentProxyOpened, } from "./agent.js";
|
|
2
|
+
export type { ChatClientMessage, ChatServerMessage, ChatAuth, ChatCreateConversation, ChatSendMessage, ChatListDirectory, ChatListFolders, ChatListHistorySessions, ChatUpgradeToSwarm, ChatListRoles, ChatAuthResult, ChatConversationCreated, ChatConversationError, ChatClaudeOutput, ChatTurnCompleted, ChatContextUsage, ChatDirectoryListing, ChatFoldersList, ChatHistorySessionsList, ChatRolesList, ChatError, } from "./chat.js";
|
|
3
|
+
export type { ProxyMessage, ProxyOpen, ProxyOpened, ProxyData, ProxyClose, } from "./proxy.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,SAAS,GACV,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ProxyOpen {
|
|
2
|
+
type: "proxy.open";
|
|
3
|
+
sessionId: string;
|
|
4
|
+
gatewayPort: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ProxyOpened {
|
|
7
|
+
type: "proxy.opened";
|
|
8
|
+
sessionId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProxyData {
|
|
11
|
+
type: "proxy.data";
|
|
12
|
+
sessionId: string;
|
|
13
|
+
data: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProxyClose {
|
|
16
|
+
type: "proxy.close";
|
|
17
|
+
sessionId: string;
|
|
18
|
+
}
|
|
19
|
+
export type ProxyMessage = ProxyOpen | ProxyOpened | ProxyData | ProxyClose;
|
|
20
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/protocol/proxy.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ── Legacy Proxy Protocol ─────────────────────────────────────────────
|
|
2
|
+
// Kept for backward compatibility with OpenClaw gateway proxy.
|
|
3
|
+
// These types are also included in the agent protocol but re-exported
|
|
4
|
+
// here for consumers that only need proxy types.
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/protocol/proxy.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,+DAA+D;AAC/D,sEAAsE;AACtE,iDAAiD"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const loginSchema: z.ZodObject<{
|
|
3
|
+
username: z.ZodString;
|
|
4
|
+
password: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
username: string;
|
|
7
|
+
password: string;
|
|
8
|
+
}, {
|
|
9
|
+
username: string;
|
|
10
|
+
password: string;
|
|
11
|
+
}>;
|
|
12
|
+
export type LoginInput = z.infer<typeof loginSchema>;
|
|
13
|
+
export declare const setupSchema: z.ZodObject<{
|
|
14
|
+
username: z.ZodString;
|
|
15
|
+
password: z.ZodString;
|
|
16
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
17
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
username: string;
|
|
20
|
+
password: string;
|
|
21
|
+
displayName?: string | undefined;
|
|
22
|
+
email?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
username: string;
|
|
25
|
+
password: string;
|
|
26
|
+
displayName?: string | undefined;
|
|
27
|
+
email?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export type SetupInput = z.infer<typeof setupSchema>;
|
|
30
|
+
export declare const registerSchema: z.ZodObject<{
|
|
31
|
+
username: z.ZodString;
|
|
32
|
+
password: z.ZodString;
|
|
33
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
34
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
username: string;
|
|
37
|
+
password: string;
|
|
38
|
+
displayName?: string | undefined;
|
|
39
|
+
email?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
username: string;
|
|
42
|
+
password: string;
|
|
43
|
+
displayName?: string | undefined;
|
|
44
|
+
email?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type RegisterInput = z.infer<typeof registerSchema>;
|
|
47
|
+
export declare const createSessionSchema: z.ZodObject<{
|
|
48
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
49
|
+
workDir: z.ZodOptional<z.ZodString>;
|
|
50
|
+
title: z.ZodOptional<z.ZodString>;
|
|
51
|
+
backendType: z.ZodDefault<z.ZodEnum<["claude-code", "openclaw", "codex"]>>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
backendType: "claude-code" | "openclaw" | "codex";
|
|
54
|
+
agentId?: string | undefined;
|
|
55
|
+
workDir?: string | undefined;
|
|
56
|
+
title?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
agentId?: string | undefined;
|
|
59
|
+
workDir?: string | undefined;
|
|
60
|
+
title?: string | undefined;
|
|
61
|
+
backendType?: "claude-code" | "openclaw" | "codex" | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
export type CreateSessionInput = z.infer<typeof createSessionSchema>;
|
|
64
|
+
export declare const updateSessionSchema: z.ZodObject<{
|
|
65
|
+
title: z.ZodOptional<z.ZodString>;
|
|
66
|
+
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
title?: string | undefined;
|
|
69
|
+
isActive?: boolean | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
title?: string | undefined;
|
|
72
|
+
isActive?: boolean | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
export type UpdateSessionInput = z.infer<typeof updateSessionSchema>;
|
|
75
|
+
export declare const listMessagesSchema: z.ZodObject<{
|
|
76
|
+
sessionId: z.ZodString;
|
|
77
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
78
|
+
before: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
sessionId: string;
|
|
81
|
+
limit: number;
|
|
82
|
+
before?: number | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
sessionId: string;
|
|
85
|
+
limit?: number | undefined;
|
|
86
|
+
before?: number | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
export type ListMessagesInput = z.infer<typeof listMessagesSchema>;
|
|
89
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAIrD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAIrD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAI3D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIrE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ── Auth Schemas ─────────────────────────────────────────────────────
|
|
3
|
+
export const loginSchema = z.object({
|
|
4
|
+
username: z.string().min(1, "Username is required"),
|
|
5
|
+
password: z.string().min(1, "Password is required"),
|
|
6
|
+
});
|
|
7
|
+
// ── Setup Schema ─────────────────────────────────────────────────────
|
|
8
|
+
export const setupSchema = z.object({
|
|
9
|
+
username: z.string().min(3, "Username must be at least 3 characters").max(50),
|
|
10
|
+
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
11
|
+
displayName: z.string().optional(),
|
|
12
|
+
email: z.string().email("Invalid email").optional().or(z.literal("")),
|
|
13
|
+
});
|
|
14
|
+
// ── Register Schema ──────────────────────────────────────────────────
|
|
15
|
+
export const registerSchema = z.object({
|
|
16
|
+
username: z.string().min(3).max(50),
|
|
17
|
+
password: z.string().min(8),
|
|
18
|
+
displayName: z.string().optional(),
|
|
19
|
+
email: z.string().email().optional().or(z.literal("")),
|
|
20
|
+
});
|
|
21
|
+
// ── Session Schemas ──────────────────────────────────────────────────
|
|
22
|
+
export const createSessionSchema = z.object({
|
|
23
|
+
agentId: z.string().uuid().optional(),
|
|
24
|
+
workDir: z.string().optional(),
|
|
25
|
+
title: z.string().optional(),
|
|
26
|
+
backendType: z.enum(["claude-code", "openclaw", "codex"]).default("claude-code"),
|
|
27
|
+
});
|
|
28
|
+
export const updateSessionSchema = z.object({
|
|
29
|
+
title: z.string().optional(),
|
|
30
|
+
isActive: z.boolean().optional(),
|
|
31
|
+
});
|
|
32
|
+
// ── Message Schemas ──────────────────────────────────────────────────
|
|
33
|
+
export const listMessagesSchema = z.object({
|
|
34
|
+
sessionId: z.string().uuid(),
|
|
35
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
36
|
+
before: z.coerce.number().int().optional(),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wEAAwE;AAExE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,sBAAsB,CAAC;CACpD,CAAC,CAAC;AAIH,wEAAwE;AAExE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,wCAAwC,CAAC,CAAC,GAAG,CAAC,EAAE,CAA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,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAIH,wEAAwE;AAExE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1D,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentStatus } from "../constants.js";
|
|
2
|
+
export interface Agent {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
hostname: string;
|
|
6
|
+
displayName: string | null;
|
|
7
|
+
status: AgentStatus;
|
|
8
|
+
version: string | null;
|
|
9
|
+
capabilities: string[] | null;
|
|
10
|
+
latencyMs: number | null;
|
|
11
|
+
connectedAt: Date | null;
|
|
12
|
+
lastHeartbeatAt: Date | null;
|
|
13
|
+
createdAt: Date | null;
|
|
14
|
+
}
|
|
15
|
+
/** In-memory representation of a connected agent */
|
|
16
|
+
export interface ConnectedAgent {
|
|
17
|
+
agentId: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
hostname: string;
|
|
20
|
+
version: string | null;
|
|
21
|
+
capabilities: string[] | null;
|
|
22
|
+
connectedAt: Date;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MessageRole, MessageType } from "../constants.js";
|
|
2
|
+
export interface Message {
|
|
3
|
+
id: number;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
role: MessageRole;
|
|
6
|
+
content: string;
|
|
7
|
+
messageType: MessageType | null;
|
|
8
|
+
toolName: string | null;
|
|
9
|
+
toolInput: Record<string, unknown> | null;
|
|
10
|
+
metadata: Record<string, unknown> | null;
|
|
11
|
+
createdAt: Date | null;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BackendType } from "../constants.js";
|
|
2
|
+
export interface Session {
|
|
3
|
+
id: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
agentId: string | null;
|
|
6
|
+
agentName: string | null;
|
|
7
|
+
claudeSessionId: string | null;
|
|
8
|
+
workDir: string | null;
|
|
9
|
+
title: string | null;
|
|
10
|
+
backendType: BackendType;
|
|
11
|
+
isCrew: boolean;
|
|
12
|
+
crewConfig: Record<string, unknown> | null;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
createdAt: Date | null;
|
|
15
|
+
updatedAt: Date | null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3C,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/types/session.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { UserRole } from "../constants.js";
|
|
2
|
+
export interface User {
|
|
3
|
+
id: string;
|
|
4
|
+
username: string;
|
|
5
|
+
displayName: string | null;
|
|
6
|
+
email: string | null;
|
|
7
|
+
role: UserRole;
|
|
8
|
+
totpEnabled: boolean;
|
|
9
|
+
createdAt: Date | null;
|
|
10
|
+
lastLoginAt: Date | null;
|
|
11
|
+
}
|
|
12
|
+
/** Safe user info sent to the browser (no password hash, no agent token) */
|
|
13
|
+
export interface PublicUser {
|
|
14
|
+
id: string;
|
|
15
|
+
username: string;
|
|
16
|
+
displayName: string | null;
|
|
17
|
+
email: string | null;
|
|
18
|
+
role: UserRole;
|
|
19
|
+
totpEnabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mclawnet/shared",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"default": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./protocol": {
|
|
11
|
+
"types": "./dist/protocol/index.d.ts",
|
|
12
|
+
"default": "./dist/protocol/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./types": {
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"default": "./dist/types/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"zod": "^3.24.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.8.3"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"clean": "rm -rf dist"
|
|
34
|
+
}
|
|
35
|
+
}
|