@miriad-systems/backend 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/agent-manager.d.ts +69 -0
- package/dist/agent-manager.d.ts.map +1 -0
- package/dist/agent-manager.js +424 -0
- package/dist/agent-manager.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +203 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +221 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-client.d.ts +80 -0
- package/dist/runtime-client.d.ts.map +1 -0
- package/dist/runtime-client.js +347 -0
- package/dist/runtime-client.js.map +1 -0
- package/dist/tymbal-bridge.d.ts +47 -0
- package/dist/tymbal-bridge.d.ts.map +1 -0
- package/dist/tymbal-bridge.js +283 -0
- package/dist/tymbal-bridge.js.map +1 -0
- package/dist/types.d.ts +181 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tymbal Bridge for Local Runtime
|
|
3
|
+
*
|
|
4
|
+
* Translates Claude Agent SDK messages to Tymbal protocol frames
|
|
5
|
+
* and sends them to the backend via the runtime's WS connection.
|
|
6
|
+
*
|
|
7
|
+
* Adapted from local-agent-engine for multi-agent support:
|
|
8
|
+
* - Frames are wrapped with agentId for routing
|
|
9
|
+
* - Uses callback instead of direct WS send (runtime manages connection)
|
|
10
|
+
*/
|
|
11
|
+
import { generateId } from './config.js';
|
|
12
|
+
export class TymbalBridge {
|
|
13
|
+
agentId;
|
|
14
|
+
callsign;
|
|
15
|
+
onFrame;
|
|
16
|
+
// Session state
|
|
17
|
+
sessionId = null;
|
|
18
|
+
// Current message tracking
|
|
19
|
+
currentAssistantMsgId = null;
|
|
20
|
+
assistantContent = '';
|
|
21
|
+
startFrameEmitted = false;
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.agentId = config.agentId;
|
|
24
|
+
this.callsign = config.callsign;
|
|
25
|
+
this.onFrame = config.onFrame;
|
|
26
|
+
}
|
|
27
|
+
getSessionId() {
|
|
28
|
+
return this.sessionId;
|
|
29
|
+
}
|
|
30
|
+
getCallsign() {
|
|
31
|
+
return this.callsign;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Process an SDK message and emit appropriate Tymbal frames.
|
|
35
|
+
*/
|
|
36
|
+
async processSDKMessage(message) {
|
|
37
|
+
switch (message.type) {
|
|
38
|
+
case 'system':
|
|
39
|
+
await this.handleSystem(message);
|
|
40
|
+
break;
|
|
41
|
+
case 'assistant':
|
|
42
|
+
await this.handleAssistant(message);
|
|
43
|
+
break;
|
|
44
|
+
case 'stream_event':
|
|
45
|
+
await this.handlePartialAssistant(message);
|
|
46
|
+
break;
|
|
47
|
+
case 'user':
|
|
48
|
+
await this.handleUser(message);
|
|
49
|
+
break;
|
|
50
|
+
case 'result':
|
|
51
|
+
await this.handleResult(message);
|
|
52
|
+
break;
|
|
53
|
+
case 'tool_progress':
|
|
54
|
+
// Tool progress events (future use)
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
console.log(`[TymbalBridge] Unhandled message type: ${message.type}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async handleSystem(message) {
|
|
61
|
+
if (message.subtype === 'init') {
|
|
62
|
+
this.sessionId = message.session_id;
|
|
63
|
+
console.log(`[TymbalBridge:${this.callsign}] Session initialized: ${this.sessionId}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async handlePartialAssistant(message) {
|
|
67
|
+
const event = message.event;
|
|
68
|
+
if (event.type === 'content_block_start') {
|
|
69
|
+
if (!this.currentAssistantMsgId) {
|
|
70
|
+
this.currentAssistantMsgId = generateId();
|
|
71
|
+
this.assistantContent = '';
|
|
72
|
+
this.startFrameEmitted = false;
|
|
73
|
+
}
|
|
74
|
+
if (!this.startFrameEmitted) {
|
|
75
|
+
await this.emitFrame({
|
|
76
|
+
i: this.currentAssistantMsgId,
|
|
77
|
+
m: { type: 'agent', sender: this.callsign, senderType: 'agent' },
|
|
78
|
+
});
|
|
79
|
+
this.startFrameEmitted = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (event.type === 'content_block_delta') {
|
|
83
|
+
const delta = event.delta;
|
|
84
|
+
if (delta && 'type' in delta && delta.type === 'text_delta' && 'text' in delta) {
|
|
85
|
+
this.assistantContent += delta.text;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async handleAssistant(message) {
|
|
90
|
+
const content = message.message.content;
|
|
91
|
+
if (!content)
|
|
92
|
+
return;
|
|
93
|
+
let textContent = '';
|
|
94
|
+
const toolUseBlocks = [];
|
|
95
|
+
for (const block of content) {
|
|
96
|
+
if (block.type === 'text' && 'text' in block) {
|
|
97
|
+
textContent += block.text;
|
|
98
|
+
}
|
|
99
|
+
else if (block.type === 'tool_use' && 'id' in block && 'name' in block) {
|
|
100
|
+
toolUseBlocks.push(block);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (textContent) {
|
|
104
|
+
const msgId = this.currentAssistantMsgId ?? generateId();
|
|
105
|
+
if (!this.startFrameEmitted) {
|
|
106
|
+
await this.emitFrame({
|
|
107
|
+
i: msgId,
|
|
108
|
+
m: { type: 'agent', sender: this.callsign, senderType: 'agent' },
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
await this.emitFrame({
|
|
112
|
+
i: msgId,
|
|
113
|
+
t: new Date().toISOString(),
|
|
114
|
+
v: {
|
|
115
|
+
type: 'agent',
|
|
116
|
+
sender: this.callsign,
|
|
117
|
+
senderType: 'agent',
|
|
118
|
+
content: textContent,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
this.currentAssistantMsgId = null;
|
|
122
|
+
this.assistantContent = '';
|
|
123
|
+
this.startFrameEmitted = false;
|
|
124
|
+
}
|
|
125
|
+
for (const toolBlock of toolUseBlocks) {
|
|
126
|
+
const toolCallId = generateId();
|
|
127
|
+
await this.emitFrame({
|
|
128
|
+
i: toolCallId,
|
|
129
|
+
t: new Date().toISOString(),
|
|
130
|
+
v: {
|
|
131
|
+
type: 'tool_call',
|
|
132
|
+
sender: this.callsign,
|
|
133
|
+
senderType: 'agent',
|
|
134
|
+
toolCallId: toolBlock.id,
|
|
135
|
+
name: toolBlock.name,
|
|
136
|
+
args: toolBlock.input,
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async handleUser(message) {
|
|
142
|
+
const apiMessage = message.message;
|
|
143
|
+
const content = apiMessage.content;
|
|
144
|
+
if (!Array.isArray(content))
|
|
145
|
+
return;
|
|
146
|
+
for (const block of content) {
|
|
147
|
+
if (typeof block === 'object' && block !== null && 'type' in block) {
|
|
148
|
+
const typedBlock = block;
|
|
149
|
+
if (typedBlock.type === 'tool_result' && 'tool_use_id' in typedBlock) {
|
|
150
|
+
const resultBlock = typedBlock;
|
|
151
|
+
const resultId = generateId();
|
|
152
|
+
const isError = resultBlock.is_error ?? false;
|
|
153
|
+
let resultContent = resultBlock.content;
|
|
154
|
+
if (Array.isArray(resultContent)) {
|
|
155
|
+
resultContent = resultContent
|
|
156
|
+
.filter((item) => typeof item === 'object' && item !== null && item.type === 'text')
|
|
157
|
+
.map((item) => item.text)
|
|
158
|
+
.join('\n');
|
|
159
|
+
}
|
|
160
|
+
await this.emitFrame({
|
|
161
|
+
i: resultId,
|
|
162
|
+
t: new Date().toISOString(),
|
|
163
|
+
v: {
|
|
164
|
+
type: 'tool_result',
|
|
165
|
+
sender: this.callsign,
|
|
166
|
+
senderType: 'agent',
|
|
167
|
+
toolCallId: resultBlock.tool_use_id,
|
|
168
|
+
content: resultContent,
|
|
169
|
+
isError,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async handleResult(message) {
|
|
177
|
+
// Finalize pending assistant message
|
|
178
|
+
if (this.currentAssistantMsgId && this.assistantContent) {
|
|
179
|
+
await this.emitFrame({
|
|
180
|
+
i: this.currentAssistantMsgId,
|
|
181
|
+
t: new Date().toISOString(),
|
|
182
|
+
v: {
|
|
183
|
+
type: 'agent',
|
|
184
|
+
sender: this.callsign,
|
|
185
|
+
senderType: 'agent',
|
|
186
|
+
content: this.assistantContent,
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
this.currentAssistantMsgId = null;
|
|
190
|
+
this.assistantContent = '';
|
|
191
|
+
this.startFrameEmitted = false;
|
|
192
|
+
}
|
|
193
|
+
// Check for errors
|
|
194
|
+
if (message.subtype !== 'success') {
|
|
195
|
+
const errorMsg = message;
|
|
196
|
+
const errorMessage = errorMsg.errors?.join(', ') ?? `Error: ${message.subtype}`;
|
|
197
|
+
await this.emitFrame({
|
|
198
|
+
i: generateId(),
|
|
199
|
+
t: new Date().toISOString(),
|
|
200
|
+
v: {
|
|
201
|
+
type: 'error',
|
|
202
|
+
sender: this.callsign,
|
|
203
|
+
senderType: 'agent',
|
|
204
|
+
content: errorMessage,
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
// Emit cost frame
|
|
209
|
+
const costValue = {
|
|
210
|
+
type: 'cost',
|
|
211
|
+
sender: this.callsign,
|
|
212
|
+
senderType: 'agent',
|
|
213
|
+
totalCostUsd: message.total_cost_usd,
|
|
214
|
+
durationMs: message.duration_ms,
|
|
215
|
+
durationApiMs: message.duration_api_ms,
|
|
216
|
+
numTurns: message.num_turns,
|
|
217
|
+
usage: {
|
|
218
|
+
inputTokens: message.usage.input_tokens,
|
|
219
|
+
outputTokens: message.usage.output_tokens,
|
|
220
|
+
cacheReadInputTokens: message.usage.cache_read_input_tokens ?? 0,
|
|
221
|
+
cacheCreationInputTokens: message.usage.cache_creation_input_tokens ?? 0,
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
if (message.modelUsage && Object.keys(message.modelUsage).length > 0) {
|
|
225
|
+
const modelUsage = {};
|
|
226
|
+
for (const [model, usage] of Object.entries(message.modelUsage)) {
|
|
227
|
+
modelUsage[model] = {
|
|
228
|
+
inputTokens: usage.inputTokens,
|
|
229
|
+
outputTokens: usage.outputTokens,
|
|
230
|
+
cacheReadInputTokens: usage.cacheReadInputTokens,
|
|
231
|
+
cacheCreationInputTokens: usage.cacheCreationInputTokens,
|
|
232
|
+
costUsd: usage.costUSD,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
costValue.modelUsage = modelUsage;
|
|
236
|
+
}
|
|
237
|
+
await this.emitFrame({
|
|
238
|
+
i: generateId(),
|
|
239
|
+
t: new Date().toISOString(),
|
|
240
|
+
v: costValue,
|
|
241
|
+
});
|
|
242
|
+
console.log(`[TymbalBridge:${this.callsign}] Cost: $${message.total_cost_usd.toFixed(4)} (${message.num_turns} turns)`);
|
|
243
|
+
// Emit idle frame (signals processing complete)
|
|
244
|
+
await this.emitFrame({
|
|
245
|
+
i: generateId(),
|
|
246
|
+
t: new Date().toISOString(),
|
|
247
|
+
v: {
|
|
248
|
+
type: 'idle',
|
|
249
|
+
sender: this.callsign,
|
|
250
|
+
senderType: 'agent',
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
async finalize() {
|
|
255
|
+
if (this.currentAssistantMsgId && this.assistantContent) {
|
|
256
|
+
await this.emitFrame({
|
|
257
|
+
i: this.currentAssistantMsgId,
|
|
258
|
+
t: new Date().toISOString(),
|
|
259
|
+
v: {
|
|
260
|
+
type: 'agent',
|
|
261
|
+
sender: this.callsign,
|
|
262
|
+
senderType: 'agent',
|
|
263
|
+
content: this.assistantContent,
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
this.currentAssistantMsgId = null;
|
|
267
|
+
this.assistantContent = '';
|
|
268
|
+
this.startFrameEmitted = false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Emit a frame wrapped with agentId for routing.
|
|
273
|
+
*/
|
|
274
|
+
async emitFrame(frame) {
|
|
275
|
+
const message = {
|
|
276
|
+
type: 'frame',
|
|
277
|
+
agentId: this.agentId,
|
|
278
|
+
frame,
|
|
279
|
+
};
|
|
280
|
+
this.onFrame(message);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=tymbal-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tymbal-bridge.js","sourceRoot":"","sources":["../src/tymbal-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAqCzC,MAAM,OAAO,YAAY;IACN,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,OAAO,CAAuC;IAE/D,gBAAgB;IACR,SAAS,GAAkB,IAAI,CAAC;IAExC,2BAA2B;IACnB,qBAAqB,GAAkB,IAAI,CAAC;IAC5C,gBAAgB,GAAW,EAAE,CAAC;IAC9B,iBAAiB,GAAY,KAAK,CAAC;IAE3C,YAAY,MAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAmB;QACzC,QAAQ,OAAO,CAAC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AC;IACxB,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol types for LocalRuntime WebSocket communication.
|
|
3
|
+
* Aligned with backend RuntimeConnectionManager protocol (spec section 2.2)
|
|
4
|
+
*/
|
|
5
|
+
export interface RuntimeConnectedMessage {
|
|
6
|
+
type: 'runtime_connected';
|
|
7
|
+
runtimeId: string;
|
|
8
|
+
protocolVersion: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ActivateAgentMessage {
|
|
11
|
+
type: 'activate';
|
|
12
|
+
agentId: string;
|
|
13
|
+
systemPrompt: string;
|
|
14
|
+
mcpServers?: McpServerConfig[];
|
|
15
|
+
workspacePath: string;
|
|
16
|
+
}
|
|
17
|
+
export interface DeliverMessageMessage {
|
|
18
|
+
type: 'message';
|
|
19
|
+
agentId: string;
|
|
20
|
+
messageId: string;
|
|
21
|
+
content: string;
|
|
22
|
+
sender: string;
|
|
23
|
+
systemPrompt?: string;
|
|
24
|
+
mcpServers?: McpServerConfig[];
|
|
25
|
+
}
|
|
26
|
+
export interface SuspendAgentMessage {
|
|
27
|
+
type: 'suspend';
|
|
28
|
+
agentId: string;
|
|
29
|
+
reason?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PingMessage {
|
|
32
|
+
type: 'ping';
|
|
33
|
+
timestamp: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ErrorMessage {
|
|
36
|
+
type: 'error';
|
|
37
|
+
code: string;
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
export type BackendToRuntimeMessage = RuntimeConnectedMessage | ActivateAgentMessage | DeliverMessageMessage | SuspendAgentMessage | PingMessage | ErrorMessage;
|
|
41
|
+
export interface RuntimeReadyMessage {
|
|
42
|
+
type: 'runtime_ready';
|
|
43
|
+
runtimeId: string;
|
|
44
|
+
spaceId: string;
|
|
45
|
+
name: string;
|
|
46
|
+
machineInfo?: {
|
|
47
|
+
os: string;
|
|
48
|
+
hostname: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface AgentCheckinMessage {
|
|
52
|
+
type: 'agent_checkin';
|
|
53
|
+
agentId: string;
|
|
54
|
+
}
|
|
55
|
+
export interface AgentHeartbeatMessage {
|
|
56
|
+
type: 'agent_heartbeat';
|
|
57
|
+
agentId: string;
|
|
58
|
+
}
|
|
59
|
+
export interface AgentFrameMessage {
|
|
60
|
+
type: 'frame';
|
|
61
|
+
agentId: string;
|
|
62
|
+
frame: TymbalFrame;
|
|
63
|
+
}
|
|
64
|
+
export interface PongMessage {
|
|
65
|
+
type: 'pong';
|
|
66
|
+
timestamp: string;
|
|
67
|
+
}
|
|
68
|
+
export type RuntimeToBackendMessage = RuntimeReadyMessage | AgentCheckinMessage | AgentHeartbeatMessage | AgentFrameMessage | PongMessage;
|
|
69
|
+
export interface McpServerConfig {
|
|
70
|
+
name: string;
|
|
71
|
+
slug?: string;
|
|
72
|
+
transport: 'stdio' | 'sse' | 'http';
|
|
73
|
+
command?: string;
|
|
74
|
+
args?: string[];
|
|
75
|
+
env?: Record<string, string>;
|
|
76
|
+
cwd?: string;
|
|
77
|
+
url?: string;
|
|
78
|
+
headers?: Record<string, string>;
|
|
79
|
+
}
|
|
80
|
+
export interface TymbalFrame {
|
|
81
|
+
i: string;
|
|
82
|
+
t?: string;
|
|
83
|
+
m?: TymbalMetadata;
|
|
84
|
+
a?: string;
|
|
85
|
+
v?: TymbalValue;
|
|
86
|
+
}
|
|
87
|
+
export interface TymbalMetadata {
|
|
88
|
+
type: TymbalValueType;
|
|
89
|
+
sender: string;
|
|
90
|
+
senderType: 'agent';
|
|
91
|
+
}
|
|
92
|
+
export type TymbalValueType = 'agent' | 'tool_call' | 'tool_result' | 'error' | 'idle' | 'cost' | 'status';
|
|
93
|
+
interface TymbalValueBase {
|
|
94
|
+
type: TymbalValueType;
|
|
95
|
+
sender: string;
|
|
96
|
+
senderType: 'agent';
|
|
97
|
+
}
|
|
98
|
+
export interface AgentValue extends TymbalValueBase {
|
|
99
|
+
type: 'agent';
|
|
100
|
+
content: string;
|
|
101
|
+
}
|
|
102
|
+
export interface ToolCallValue extends TymbalValueBase {
|
|
103
|
+
type: 'tool_call';
|
|
104
|
+
toolCallId: string;
|
|
105
|
+
name: string;
|
|
106
|
+
args: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
export interface ToolResultValue extends TymbalValueBase {
|
|
109
|
+
type: 'tool_result';
|
|
110
|
+
toolCallId: string;
|
|
111
|
+
content: unknown;
|
|
112
|
+
isError: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface ErrorValue extends TymbalValueBase {
|
|
115
|
+
type: 'error';
|
|
116
|
+
content: string;
|
|
117
|
+
}
|
|
118
|
+
export interface IdleValue extends TymbalValueBase {
|
|
119
|
+
type: 'idle';
|
|
120
|
+
}
|
|
121
|
+
export interface CostUsage {
|
|
122
|
+
inputTokens: number;
|
|
123
|
+
outputTokens: number;
|
|
124
|
+
cacheReadInputTokens: number;
|
|
125
|
+
cacheCreationInputTokens: number;
|
|
126
|
+
}
|
|
127
|
+
export interface CostModelUsage extends CostUsage {
|
|
128
|
+
costUsd: number;
|
|
129
|
+
}
|
|
130
|
+
export interface CostValue extends TymbalValueBase {
|
|
131
|
+
type: 'cost';
|
|
132
|
+
totalCostUsd: number;
|
|
133
|
+
durationMs: number;
|
|
134
|
+
durationApiMs: number;
|
|
135
|
+
numTurns: number;
|
|
136
|
+
usage: CostUsage;
|
|
137
|
+
modelUsage?: Record<string, CostModelUsage>;
|
|
138
|
+
}
|
|
139
|
+
export type TymbalValue = AgentValue | ToolCallValue | ToolResultValue | ErrorValue | IdleValue | CostValue;
|
|
140
|
+
/** Runtime config stored in ~/.config/miriad/config.json */
|
|
141
|
+
export interface RuntimeConfig {
|
|
142
|
+
spaceId: string;
|
|
143
|
+
name: string;
|
|
144
|
+
credentials: {
|
|
145
|
+
runtimeId: string;
|
|
146
|
+
serverId: string;
|
|
147
|
+
secret: string;
|
|
148
|
+
apiUrl: string;
|
|
149
|
+
wsUrl: string;
|
|
150
|
+
};
|
|
151
|
+
workspace: {
|
|
152
|
+
basePath: string;
|
|
153
|
+
};
|
|
154
|
+
createdAt: string;
|
|
155
|
+
}
|
|
156
|
+
/** Bootstrap exchange response */
|
|
157
|
+
export interface BootstrapResponse {
|
|
158
|
+
serverId: string;
|
|
159
|
+
secret: string;
|
|
160
|
+
spaceId: string;
|
|
161
|
+
host: string;
|
|
162
|
+
wsHost: string;
|
|
163
|
+
}
|
|
164
|
+
/** Parsed connection string */
|
|
165
|
+
export interface ParsedConnectionString {
|
|
166
|
+
host: string;
|
|
167
|
+
bootstrapToken: string;
|
|
168
|
+
spaceId: string;
|
|
169
|
+
}
|
|
170
|
+
export type AgentStatus = 'activating' | 'online' | 'busy' | 'offline' | 'error';
|
|
171
|
+
export interface AgentState {
|
|
172
|
+
agentId: string;
|
|
173
|
+
status: AgentStatus;
|
|
174
|
+
workspacePath: string;
|
|
175
|
+
systemPrompt: string;
|
|
176
|
+
mcpServers?: McpServerConfig[];
|
|
177
|
+
activatedAt: string;
|
|
178
|
+
lastActivity: string;
|
|
179
|
+
}
|
|
180
|
+
export {};
|
|
181
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;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AAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+BAA+B;AAC/B,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@miriad-systems/backend",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Run CAST agents on your local machine",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/cli.js",
|
|
7
|
+
"bin": "./dist/cli.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"cast",
|
|
20
|
+
"claude",
|
|
21
|
+
"agent",
|
|
22
|
+
"local",
|
|
23
|
+
"runtime"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@anthropic-ai/claude-agent-sdk": "^0.1.76",
|
|
31
|
+
"ulid": "^2.3.0",
|
|
32
|
+
"ws": "^8.16.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^20.10.0",
|
|
36
|
+
"@types/ws": "^8.5.10",
|
|
37
|
+
"tsx": "^4.7.0",
|
|
38
|
+
"typescript": "^5.3.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc",
|
|
42
|
+
"dev": "tsx src/cli.ts",
|
|
43
|
+
"start": "node dist/cli.js",
|
|
44
|
+
"typecheck": "tsc --noEmit"
|
|
45
|
+
}
|
|
46
|
+
}
|