roboport 0.0.1 → 0.2.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/README.md +3 -2
- package/core/agent.d.ts +2 -1
- package/gateways/core.d.ts +27 -0
- package/gateways/index.d.ts +5 -0
- package/gateways/index.js +575 -0
- package/gateways/serve.d.ts +19 -0
- package/gateways/sources/telegram.d.ts +28 -0
- package/gateways/store.d.ts +9 -0
- package/harness/index.js +15 -6
- package/index.js +15 -6
- package/mcp/auth.d.ts +2 -0
- package/mcp/index.d.ts +4 -1
- package/mcp/index.js +814 -795
- package/models/index.js +15 -6
- package/package.json +9 -5
- package/skills/index.js +15 -6
- package/triggers/core.d.ts +1 -1
- package/triggers/index.js +10 -2
- package/triggers/sources/telegram.d.ts +9 -1
package/models/index.js
CHANGED
|
@@ -205,7 +205,7 @@ class Agent {
|
|
|
205
205
|
this.unsubs = [];
|
|
206
206
|
await Promise.all(unsubs.map((u) => u()));
|
|
207
207
|
}
|
|
208
|
-
buildSystem(allTools) {
|
|
208
|
+
buildSystem(allTools, systemExtension) {
|
|
209
209
|
let system = this.system;
|
|
210
210
|
if (this.skills.length > 0) {
|
|
211
211
|
const skillsList = this.skills.map((skill) => `- ${skill.name}: ${skill.description}`).join(`
|
|
@@ -226,6 +226,11 @@ ${skillsList}`;
|
|
|
226
226
|
# Deferred tools
|
|
227
227
|
These tools are available but their schemas are not loaded. Use ToolSearch to load them before calling.
|
|
228
228
|
${list}`;
|
|
229
|
+
}
|
|
230
|
+
if (systemExtension) {
|
|
231
|
+
system = `${system}
|
|
232
|
+
|
|
233
|
+
${systemExtension}`;
|
|
229
234
|
}
|
|
230
235
|
return system;
|
|
231
236
|
}
|
|
@@ -252,6 +257,7 @@ ${found.content}
|
|
|
252
257
|
session(init) {
|
|
253
258
|
const initialMessages = init?.messages ? [...init.messages] : [];
|
|
254
259
|
const sessionCwd = init?.cwd ?? this.cwd ?? process.cwd();
|
|
260
|
+
const systemExtension = init?.systemExtension;
|
|
255
261
|
const state = {
|
|
256
262
|
messages: initialMessages,
|
|
257
263
|
store: new Map
|
|
@@ -284,11 +290,14 @@ ${found.content}
|
|
|
284
290
|
tools: registry,
|
|
285
291
|
cwd: sessionCwd
|
|
286
292
|
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
293
|
+
const systemMessage = {
|
|
294
|
+
role: "system",
|
|
295
|
+
content: this.buildSystem(allTools, systemExtension)
|
|
296
|
+
};
|
|
297
|
+
if (state.messages[0]?.role === "system") {
|
|
298
|
+
state.messages[0] = systemMessage;
|
|
299
|
+
} else {
|
|
300
|
+
state.messages.unshift(systemMessage);
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
return { tools: allTools, registry, ctx };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roboport",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Minimal TypeScript framework for building LLM agents.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Timur Badretdinov",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"llm",
|
|
21
21
|
"agent",
|
|
22
22
|
"ai",
|
|
23
|
-
"mcp"
|
|
24
|
-
"anthropic",
|
|
25
|
-
"openai",
|
|
26
|
-
"typescript"
|
|
23
|
+
"mcp"
|
|
27
24
|
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"bun": ">=1.0.0"
|
|
27
|
+
},
|
|
28
28
|
"type": "module",
|
|
29
29
|
"main": "./index.js",
|
|
30
30
|
"types": "./index.d.ts",
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./index.d.ts",
|
|
34
34
|
"import": "./index.js"
|
|
35
35
|
},
|
|
36
|
+
"./gateways": {
|
|
37
|
+
"types": "./gateways/index.d.ts",
|
|
38
|
+
"import": "./gateways/index.js"
|
|
39
|
+
},
|
|
36
40
|
"./harness": {
|
|
37
41
|
"types": "./harness/index.d.ts",
|
|
38
42
|
"import": "./harness/index.js"
|
package/skills/index.js
CHANGED
|
@@ -205,7 +205,7 @@ class Agent {
|
|
|
205
205
|
this.unsubs = [];
|
|
206
206
|
await Promise.all(unsubs.map((u) => u()));
|
|
207
207
|
}
|
|
208
|
-
buildSystem(allTools) {
|
|
208
|
+
buildSystem(allTools, systemExtension) {
|
|
209
209
|
let system = this.system;
|
|
210
210
|
if (this.skills.length > 0) {
|
|
211
211
|
const skillsList = this.skills.map((skill) => `- ${skill.name}: ${skill.description}`).join(`
|
|
@@ -226,6 +226,11 @@ ${skillsList}`;
|
|
|
226
226
|
# Deferred tools
|
|
227
227
|
These tools are available but their schemas are not loaded. Use ToolSearch to load them before calling.
|
|
228
228
|
${list}`;
|
|
229
|
+
}
|
|
230
|
+
if (systemExtension) {
|
|
231
|
+
system = `${system}
|
|
232
|
+
|
|
233
|
+
${systemExtension}`;
|
|
229
234
|
}
|
|
230
235
|
return system;
|
|
231
236
|
}
|
|
@@ -252,6 +257,7 @@ ${found.content}
|
|
|
252
257
|
session(init) {
|
|
253
258
|
const initialMessages = init?.messages ? [...init.messages] : [];
|
|
254
259
|
const sessionCwd = init?.cwd ?? this.cwd ?? process.cwd();
|
|
260
|
+
const systemExtension = init?.systemExtension;
|
|
255
261
|
const state = {
|
|
256
262
|
messages: initialMessages,
|
|
257
263
|
store: new Map
|
|
@@ -284,11 +290,14 @@ ${found.content}
|
|
|
284
290
|
tools: registry,
|
|
285
291
|
cwd: sessionCwd
|
|
286
292
|
};
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
293
|
+
const systemMessage = {
|
|
294
|
+
role: "system",
|
|
295
|
+
content: this.buildSystem(allTools, systemExtension)
|
|
296
|
+
};
|
|
297
|
+
if (state.messages[0]?.role === "system") {
|
|
298
|
+
state.messages[0] = systemMessage;
|
|
299
|
+
} else {
|
|
300
|
+
state.messages.unshift(systemMessage);
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
return { tools: allTools, registry, ctx };
|
package/triggers/core.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ interface CustomTriggerInit<T> {
|
|
|
11
11
|
start: (emit: Emit<T>) => MaybePromise<Unsub>;
|
|
12
12
|
}
|
|
13
13
|
declare function trigger<T = unknown>(init: CustomTriggerInit<T>): Trigger<T>;
|
|
14
|
-
export { trigger, type Emit, type Trigger, type TriggerHandler, type Unsub };
|
|
14
|
+
export { trigger, type Emit, type MaybePromise, type Trigger, type TriggerHandler, type Unsub, };
|
package/triggers/index.js
CHANGED
|
@@ -497,11 +497,12 @@ class TelegramClient {
|
|
|
497
497
|
this.token = token;
|
|
498
498
|
this.baseUrl = (opts?.baseUrl ?? TELEGRAM_API_BASE).replace(/\/+$/, "");
|
|
499
499
|
}
|
|
500
|
-
async call(method, params) {
|
|
500
|
+
async call(method, params, signal) {
|
|
501
501
|
const response = await fetch(`${this.baseUrl}/bot${this.token}/${method}`, {
|
|
502
502
|
method: "POST",
|
|
503
503
|
headers: { "content-type": "application/json" },
|
|
504
|
-
body: JSON.stringify(params)
|
|
504
|
+
body: JSON.stringify(params),
|
|
505
|
+
...signal ? { signal } : {}
|
|
505
506
|
});
|
|
506
507
|
const data = await response.json();
|
|
507
508
|
if (!data.ok) {
|
|
@@ -568,6 +569,13 @@ class TelegramClient {
|
|
|
568
569
|
...opts?.dropPendingUpdates ? { drop_pending_updates: true } : {}
|
|
569
570
|
});
|
|
570
571
|
}
|
|
572
|
+
getUpdates(opts) {
|
|
573
|
+
return this.call("getUpdates", {
|
|
574
|
+
...opts?.offset !== undefined ? { offset: opts.offset } : {},
|
|
575
|
+
...opts?.timeout !== undefined ? { timeout: opts.timeout } : {},
|
|
576
|
+
...opts?.allowedUpdates ? { allowed_updates: opts.allowedUpdates } : {}
|
|
577
|
+
}, opts?.signal);
|
|
578
|
+
}
|
|
571
579
|
}
|
|
572
580
|
function telegram(options) {
|
|
573
581
|
return new TelegramReceiver(options);
|
|
@@ -17,6 +17,7 @@ interface TelegramChat {
|
|
|
17
17
|
}
|
|
18
18
|
interface TelegramMessage {
|
|
19
19
|
message_id: number;
|
|
20
|
+
message_thread_id?: number;
|
|
20
21
|
from?: TelegramUser;
|
|
21
22
|
chat: TelegramChat;
|
|
22
23
|
date: number;
|
|
@@ -45,6 +46,7 @@ interface TelegramReceiverOptions {
|
|
|
45
46
|
secretToken: string;
|
|
46
47
|
updateCacheSize?: number;
|
|
47
48
|
}
|
|
49
|
+
declare function matchesCommand(message: TelegramMessage, commands: string[], botUsername?: string): boolean;
|
|
48
50
|
declare class TelegramReceiver {
|
|
49
51
|
private messageBus;
|
|
50
52
|
private editedMessageBus;
|
|
@@ -80,6 +82,12 @@ declare class TelegramClient {
|
|
|
80
82
|
deleteWebhook(opts?: {
|
|
81
83
|
dropPendingUpdates?: boolean;
|
|
82
84
|
}): Promise<boolean>;
|
|
85
|
+
getUpdates(opts?: {
|
|
86
|
+
offset?: number;
|
|
87
|
+
timeout?: number;
|
|
88
|
+
allowedUpdates?: string[];
|
|
89
|
+
signal?: AbortSignal;
|
|
90
|
+
}): Promise<TelegramUpdate[]>;
|
|
83
91
|
}
|
|
84
92
|
declare function telegram(options: TelegramReceiverOptions): TelegramReceiver;
|
|
85
|
-
export { telegram, TelegramClient, TelegramReceiver, splitMessage, type SendMessageDraftOptions, type SendMessageOptions, type TelegramChat, type TelegramChatAction, type TelegramMessage, type TelegramReceiverOptions, type TelegramUpdate, type TelegramUser, };
|
|
93
|
+
export { matchesCommand, telegram, TelegramClient, TelegramReceiver, splitMessage, type SendMessageDraftOptions, type SendMessageOptions, type TelegramChat, type TelegramChatAction, type TelegramMessage, type TelegramReceiverOptions, type TelegramUpdate, type TelegramUser, };
|