verybot 0.1.3
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/brain/agent-registry.d.ts +75 -0
- package/dist/brain/agent-registry.js +124 -0
- package/dist/brain/agent.d.ts +146 -0
- package/dist/brain/agent.js +680 -0
- package/dist/brain/channel-store.d.ts +27 -0
- package/dist/brain/channel-store.js +78 -0
- package/dist/brain/compaction.d.ts +37 -0
- package/dist/brain/compaction.js +214 -0
- package/dist/brain/context.d.ts +33 -0
- package/dist/brain/context.js +77 -0
- package/dist/brain/delegation-store.d.ts +33 -0
- package/dist/brain/delegation-store.js +106 -0
- package/dist/brain/loop.d.ts +21 -0
- package/dist/brain/loop.js +161 -0
- package/dist/brain/mcp-adapter.d.ts +39 -0
- package/dist/brain/mcp-adapter.js +227 -0
- package/dist/brain/memory-extractor.d.ts +26 -0
- package/dist/brain/memory-extractor.js +82 -0
- package/dist/brain/providers.d.ts +10 -0
- package/dist/brain/providers.js +69 -0
- package/dist/brain/queue.d.ts +18 -0
- package/dist/brain/queue.js +84 -0
- package/dist/brain/run-tools.d.ts +47 -0
- package/dist/brain/run-tools.js +84 -0
- package/dist/brain/session-key.d.ts +23 -0
- package/dist/brain/session-key.js +41 -0
- package/dist/brain/session-state.d.ts +36 -0
- package/dist/brain/session-state.js +51 -0
- package/dist/brain/session-store.d.ts +50 -0
- package/dist/brain/session-store.js +207 -0
- package/dist/brain/session.d.ts +32 -0
- package/dist/brain/session.js +75 -0
- package/dist/brain/utils.d.ts +4 -0
- package/dist/brain/utils.js +26 -0
- package/dist/brain/worker-coordinator.d.ts +25 -0
- package/dist/brain/worker-coordinator.js +83 -0
- package/dist/channels/commands.d.ts +35 -0
- package/dist/channels/commands.js +65 -0
- package/dist/channels/discord/channel.d.ts +18 -0
- package/dist/channels/discord/channel.js +154 -0
- package/dist/channels/discord/markdown.d.ts +19 -0
- package/dist/channels/discord/markdown.js +62 -0
- package/dist/channels/manager.d.ts +29 -0
- package/dist/channels/manager.js +100 -0
- package/dist/channels/slack/channel.d.ts +26 -0
- package/dist/channels/slack/channel.js +207 -0
- package/dist/channels/slack/markdown.d.ts +19 -0
- package/dist/channels/slack/markdown.js +62 -0
- package/dist/channels/specs.d.ts +21 -0
- package/dist/channels/specs.js +96 -0
- package/dist/channels/telegram/channel.d.ts +18 -0
- package/dist/channels/telegram/channel.js +156 -0
- package/dist/channels/telegram/markdown.d.ts +17 -0
- package/dist/channels/telegram/markdown.js +66 -0
- package/dist/channels/types.d.ts +26 -0
- package/dist/channels/types.js +1 -0
- package/dist/channels/whatsapp/channel.d.ts +23 -0
- package/dist/channels/whatsapp/channel.js +242 -0
- package/dist/channels/whatsapp/markdown.d.ts +20 -0
- package/dist/channels/whatsapp/markdown.js +51 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/config.js +78 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +13 -0
- package/dist/computer/browser/actions.d.ts +31 -0
- package/dist/computer/browser/actions.js +148 -0
- package/dist/computer/browser/manager.d.ts +55 -0
- package/dist/computer/browser/manager.js +496 -0
- package/dist/computer/browser/profile-badge.d.ts +13 -0
- package/dist/computer/browser/profile-badge.js +67 -0
- package/dist/computer/browser/screenshot.d.ts +5 -0
- package/dist/computer/browser/screenshot.js +21 -0
- package/dist/computer/browser/snapshot.d.ts +30 -0
- package/dist/computer/browser/snapshot.js +242 -0
- package/dist/computer/browser/tools.d.ts +5 -0
- package/dist/computer/browser/tools.js +167 -0
- package/dist/computer/desktop/adapter.d.ts +25 -0
- package/dist/computer/desktop/adapter.js +11 -0
- package/dist/computer/desktop/macos.d.ts +24 -0
- package/dist/computer/desktop/macos.js +223 -0
- package/dist/computer/desktop/tools.d.ts +25 -0
- package/dist/computer/desktop/tools.js +114 -0
- package/dist/config/agent-config.d.ts +41 -0
- package/dist/config/agent-config.js +14 -0
- package/dist/config/model-catalog.d.ts +22 -0
- package/dist/config/model-catalog.js +99 -0
- package/dist/config/store.d.ts +25 -0
- package/dist/config/store.js +143 -0
- package/dist/config.d.ts +103 -0
- package/dist/config.js +224 -0
- package/dist/control-ui/assets/index-BANXNUyt.js +143 -0
- package/dist/control-ui/assets/index-BSUFrP9R.css +1 -0
- package/dist/control-ui/assets/noto-sans-cyrillic-ext-wght-normal-DSNfmdVt.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-cyrillic-wght-normal-B2hlT84T.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-devanagari-wght-normal-Cv-Vwajv.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-greek-ext-wght-normal-12T8GTDR.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-greek-wght-normal-Ymb6dZNd.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-latin-ext-wght-normal-W1qJv59z.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-latin-wght-normal-BYSzYMf3.woff2 +0 -0
- package/dist/control-ui/assets/noto-sans-vietnamese-wght-normal-DLTJy58D.woff2 +0 -0
- package/dist/control-ui/index.html +14 -0
- package/dist/control-ui/vite.svg +1 -0
- package/dist/events.d.ts +2 -0
- package/dist/events.js +11 -0
- package/dist/gateway/broadcast.d.ts +5 -0
- package/dist/gateway/broadcast.js +33 -0
- package/dist/gateway/methods/chat.d.ts +24 -0
- package/dist/gateway/methods/chat.js +19 -0
- package/dist/gateway/methods/config.d.ts +13 -0
- package/dist/gateway/methods/config.js +14 -0
- package/dist/gateway/methods/models.d.ts +10 -0
- package/dist/gateway/methods/models.js +14 -0
- package/dist/gateway/methods/prompt-templates.d.ts +23 -0
- package/dist/gateway/methods/prompt-templates.js +82 -0
- package/dist/gateway/methods/scheduler.d.ts +62 -0
- package/dist/gateway/methods/scheduler.js +129 -0
- package/dist/gateway/methods/sessions.d.ts +26 -0
- package/dist/gateway/methods/sessions.js +54 -0
- package/dist/gateway/methods/skills.d.ts +35 -0
- package/dist/gateway/methods/skills.js +202 -0
- package/dist/gateway/methods/system.d.ts +12 -0
- package/dist/gateway/methods/system.js +39 -0
- package/dist/gateway/methods/tasks.d.ts +21 -0
- package/dist/gateway/methods/tasks.js +46 -0
- package/dist/gateway/methods/teams.d.ts +70 -0
- package/dist/gateway/methods/teams.js +374 -0
- package/dist/gateway/methods/tools.d.ts +6 -0
- package/dist/gateway/methods/tools.js +7 -0
- package/dist/gateway/methods/whatsapp.d.ts +19 -0
- package/dist/gateway/methods/whatsapp.js +35 -0
- package/dist/gateway/rpc.d.ts +38 -0
- package/dist/gateway/rpc.js +75 -0
- package/dist/gateway/server.d.ts +4 -0
- package/dist/gateway/server.js +133 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +212 -0
- package/dist/integrations/github.d.ts +7 -0
- package/dist/integrations/github.js +133 -0
- package/dist/integrations/mcp.d.ts +7 -0
- package/dist/integrations/mcp.js +106 -0
- package/dist/integrations/registry.d.ts +43 -0
- package/dist/integrations/registry.js +258 -0
- package/dist/integrations/scanner.d.ts +10 -0
- package/dist/integrations/scanner.js +122 -0
- package/dist/integrations/twitter.d.ts +10 -0
- package/dist/integrations/twitter.js +120 -0
- package/dist/integrations/types.d.ts +72 -0
- package/dist/integrations/types.js +1 -0
- package/dist/logger.d.ts +16 -0
- package/dist/logger.js +104 -0
- package/dist/markdown/chunk.d.ts +9 -0
- package/dist/markdown/chunk.js +52 -0
- package/dist/markdown/ir.d.ts +37 -0
- package/dist/markdown/ir.js +529 -0
- package/dist/markdown/render.d.ts +22 -0
- package/dist/markdown/render.js +148 -0
- package/dist/markdown/table-render.d.ts +43 -0
- package/dist/markdown/table-render.js +219 -0
- package/dist/markdown/tables.d.ts +17 -0
- package/dist/markdown/tables.js +27 -0
- package/dist/memory/embedding.d.ts +16 -0
- package/dist/memory/embedding.js +66 -0
- package/dist/memory/extractor.d.ts +6 -0
- package/dist/memory/extractor.js +72 -0
- package/dist/memory/search.d.ts +15 -0
- package/dist/memory/search.js +57 -0
- package/dist/memory/store.d.ts +34 -0
- package/dist/memory/store.js +328 -0
- package/dist/memory/types.d.ts +9 -0
- package/dist/memory/types.js +2 -0
- package/dist/paths.d.ts +20 -0
- package/dist/paths.js +29 -0
- package/dist/prompt-templates/builtins.d.ts +2 -0
- package/dist/prompt-templates/builtins.js +72 -0
- package/dist/prompt-templates/store.d.ts +39 -0
- package/dist/prompt-templates/store.js +174 -0
- package/dist/prompt-templates/types.d.ts +10 -0
- package/dist/prompt-templates/types.js +1 -0
- package/dist/scheduler/connected-channels.d.ts +24 -0
- package/dist/scheduler/connected-channels.js +57 -0
- package/dist/scheduler/scheduler.d.ts +22 -0
- package/dist/scheduler/scheduler.js +132 -0
- package/dist/scheduler/store.d.ts +27 -0
- package/dist/scheduler/store.js +205 -0
- package/dist/scheduler/types.d.ts +29 -0
- package/dist/scheduler/types.js +1 -0
- package/dist/security/command-validator.d.ts +22 -0
- package/dist/security/command-validator.js +160 -0
- package/dist/security/docker-sandbox.d.ts +48 -0
- package/dist/security/docker-sandbox.js +218 -0
- package/dist/security/env-filter.d.ts +8 -0
- package/dist/security/env-filter.js +41 -0
- package/dist/skills/loader.d.ts +33 -0
- package/dist/skills/loader.js +132 -0
- package/dist/skills/prompt.d.ts +6 -0
- package/dist/skills/prompt.js +17 -0
- package/dist/skills/read-tool.d.ts +7 -0
- package/dist/skills/read-tool.js +24 -0
- package/dist/skills/scanner.d.ts +6 -0
- package/dist/skills/scanner.js +73 -0
- package/dist/skills/types.d.ts +15 -0
- package/dist/skills/types.js +1 -0
- package/dist/tasks/store.d.ts +47 -0
- package/dist/tasks/store.js +193 -0
- package/dist/tasks/types.d.ts +75 -0
- package/dist/tasks/types.js +32 -0
- package/dist/teams/store.d.ts +78 -0
- package/dist/teams/store.js +420 -0
- package/dist/teams/types.d.ts +23 -0
- package/dist/teams/types.js +1 -0
- package/dist/tools/bash.d.ts +16 -0
- package/dist/tools/bash.js +62 -0
- package/dist/tools/channel-history.d.ts +10 -0
- package/dist/tools/channel-history.js +43 -0
- package/dist/tools/delegate.d.ts +16 -0
- package/dist/tools/delegate.js +216 -0
- package/dist/tools/fs.d.ts +4 -0
- package/dist/tools/fs.js +335 -0
- package/dist/tools/integration-toggle.d.ts +14 -0
- package/dist/tools/integration-toggle.js +47 -0
- package/dist/tools/memory.d.ts +13 -0
- package/dist/tools/memory.js +65 -0
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/registry.js +9 -0
- package/dist/tools/schedule.d.ts +8 -0
- package/dist/tools/schedule.js +219 -0
- package/dist/tools/speak.d.ts +10 -0
- package/dist/tools/speak.js +56 -0
- package/dist/tools/tasks.d.ts +29 -0
- package/dist/tools/tasks.js +92 -0
- package/dist/tools/teams.d.ts +7 -0
- package/dist/tools/teams.js +180 -0
- package/dist/tools/web-fetch.d.ts +3 -0
- package/dist/tools/web-fetch.js +22 -0
- package/dist/tts/edge.d.ts +10 -0
- package/dist/tts/edge.js +60 -0
- package/dist/tts/speak.d.ts +12 -0
- package/dist/tts/speak.js +81 -0
- package/dist/tts/transcribe.d.ts +5 -0
- package/dist/tts/transcribe.js +40 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +22 -0
- package/package.json +90 -0
- package/verybot.js +2 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { LanguageModel, ToolSet } from "ai";
|
|
2
|
+
import type { AgentConfig, TeamConfig } from "../config/agent-config.js";
|
|
3
|
+
import type { Config } from "../config.js";
|
|
4
|
+
import type { MemoryStore } from "../memory/store.js";
|
|
5
|
+
import type { EmbeddingProvider } from "../memory/embedding.js";
|
|
6
|
+
import type { ModelDef } from "../config/model-catalog.js";
|
|
7
|
+
export interface WorkerDeps {
|
|
8
|
+
memoryStore: MemoryStore | null;
|
|
9
|
+
embeddingProvider: EmbeddingProvider | null;
|
|
10
|
+
baseTools: ToolSet;
|
|
11
|
+
config: Config;
|
|
12
|
+
}
|
|
13
|
+
export interface ResolvedAgent {
|
|
14
|
+
agentConfig: AgentConfig;
|
|
15
|
+
model: LanguageModel;
|
|
16
|
+
modelDef: ModelDef;
|
|
17
|
+
tools: ToolSet;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Holds agent configs for a single team.
|
|
21
|
+
* The first config is the orchestrator, rest are workers.
|
|
22
|
+
* `canDelegate` is auto-derived from team membership.
|
|
23
|
+
*/
|
|
24
|
+
export declare class AgentRegistry {
|
|
25
|
+
private deps;
|
|
26
|
+
private orchestratorConfig;
|
|
27
|
+
/** Workers keyed by name (human-readable, unique within team). */
|
|
28
|
+
private workersByName;
|
|
29
|
+
private workerNames;
|
|
30
|
+
constructor(orchestrator: AgentConfig, workers: AgentConfig[], deps: WorkerDeps);
|
|
31
|
+
getOrchestrator(): AgentConfig;
|
|
32
|
+
/** Resolve the orchestrator into a model + def, ready for per-session override. */
|
|
33
|
+
resolveOrchestrator(): ResolvedAgent;
|
|
34
|
+
getWorker(name: string): AgentConfig | undefined;
|
|
35
|
+
/** Return the list of worker names that the orchestrator can delegate to. */
|
|
36
|
+
delegatableWorkers(): string[];
|
|
37
|
+
/** Build an id→name map for all agents (orchestrator + workers). */
|
|
38
|
+
buildIdToNameMap(): Map<string, string>;
|
|
39
|
+
/** Resolve a worker by name into a model + filtered tool set, ready for runLoop(). */
|
|
40
|
+
resolveWorker(name: string): ResolvedAgent | null;
|
|
41
|
+
}
|
|
42
|
+
/** Info returned by TeamRegistry.listTeams() for UI display. */
|
|
43
|
+
export interface TeamInfo {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
color: string;
|
|
47
|
+
orchestratorId: string;
|
|
48
|
+
orchestratorIdentity: string;
|
|
49
|
+
orchestratorModel: string;
|
|
50
|
+
workerCount: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Wraps per-team AgentRegistry instances.
|
|
54
|
+
* Provides team resolution and isolation boundaries.
|
|
55
|
+
*/
|
|
56
|
+
export declare class TeamRegistry {
|
|
57
|
+
private teams;
|
|
58
|
+
constructor(teams: TeamConfig[], deps: WorkerDeps);
|
|
59
|
+
/** Find which team owns an orchestrator ID. */
|
|
60
|
+
resolveTeam(orchestratorId: string): {
|
|
61
|
+
teamId: string;
|
|
62
|
+
registry: AgentRegistry;
|
|
63
|
+
} | null;
|
|
64
|
+
/** Get registry for a specific team by teamId. */
|
|
65
|
+
getTeamRegistry(teamId: string): AgentRegistry | null;
|
|
66
|
+
/** All teams for UI picker. */
|
|
67
|
+
listTeams(): TeamInfo[];
|
|
68
|
+
/** True if any team has workers. */
|
|
69
|
+
hasWorkers(): boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Parse "provider:modelId" string. */
|
|
72
|
+
export declare function parseModel(raw: string): {
|
|
73
|
+
provider: string;
|
|
74
|
+
modelId: string;
|
|
75
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { getModel } from "./providers.js";
|
|
2
|
+
import { resolveModelDef } from "../config/model-catalog.js";
|
|
3
|
+
/**
|
|
4
|
+
* Holds agent configs for a single team.
|
|
5
|
+
* The first config is the orchestrator, rest are workers.
|
|
6
|
+
* `canDelegate` is auto-derived from team membership.
|
|
7
|
+
*/
|
|
8
|
+
export class AgentRegistry {
|
|
9
|
+
deps;
|
|
10
|
+
orchestratorConfig;
|
|
11
|
+
/** Workers keyed by name (human-readable, unique within team). */
|
|
12
|
+
workersByName;
|
|
13
|
+
workerNames;
|
|
14
|
+
constructor(orchestrator, workers, deps) {
|
|
15
|
+
this.deps = deps;
|
|
16
|
+
this.orchestratorConfig = orchestrator;
|
|
17
|
+
this.workersByName = new Map(workers.map((w) => [w.name, w]));
|
|
18
|
+
this.workerNames = workers.map((w) => w.name);
|
|
19
|
+
}
|
|
20
|
+
getOrchestrator() {
|
|
21
|
+
return this.orchestratorConfig;
|
|
22
|
+
}
|
|
23
|
+
/** Resolve the orchestrator into a model + def, ready for per-session override. */
|
|
24
|
+
resolveOrchestrator() {
|
|
25
|
+
const cfg = this.orchestratorConfig;
|
|
26
|
+
const { provider, modelId } = parseModel(cfg.model);
|
|
27
|
+
const model = getModel(provider, modelId);
|
|
28
|
+
const modelDef = resolveModelDef(modelId, cfg.contextWindow);
|
|
29
|
+
const tools = filterTools(this.deps.baseTools, cfg.tools);
|
|
30
|
+
return { agentConfig: cfg, model, modelDef, tools };
|
|
31
|
+
}
|
|
32
|
+
getWorker(name) {
|
|
33
|
+
return this.workersByName.get(name);
|
|
34
|
+
}
|
|
35
|
+
/** Return the list of worker names that the orchestrator can delegate to. */
|
|
36
|
+
delegatableWorkers() {
|
|
37
|
+
return this.workerNames;
|
|
38
|
+
}
|
|
39
|
+
/** Build an id→name map for all agents (orchestrator + workers). */
|
|
40
|
+
buildIdToNameMap() {
|
|
41
|
+
const map = new Map();
|
|
42
|
+
map.set(this.orchestratorConfig.id, this.orchestratorConfig.name);
|
|
43
|
+
for (const w of this.workersByName.values()) {
|
|
44
|
+
map.set(w.id, w.name);
|
|
45
|
+
}
|
|
46
|
+
return map;
|
|
47
|
+
}
|
|
48
|
+
/** Resolve a worker by name into a model + filtered tool set, ready for runLoop(). */
|
|
49
|
+
resolveWorker(name) {
|
|
50
|
+
const cfg = this.workersByName.get(name);
|
|
51
|
+
if (!cfg)
|
|
52
|
+
return null;
|
|
53
|
+
const { provider, modelId } = parseModel(cfg.model);
|
|
54
|
+
const model = getModel(provider, modelId);
|
|
55
|
+
const modelDef = resolveModelDef(modelId, cfg.contextWindow);
|
|
56
|
+
const tools = filterTools(this.deps.baseTools, cfg.tools);
|
|
57
|
+
return { agentConfig: cfg, model, modelDef, tools };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Wraps per-team AgentRegistry instances.
|
|
62
|
+
* Provides team resolution and isolation boundaries.
|
|
63
|
+
*/
|
|
64
|
+
export class TeamRegistry {
|
|
65
|
+
teams;
|
|
66
|
+
constructor(teams, deps) {
|
|
67
|
+
this.teams = new Map(teams.map((t) => [
|
|
68
|
+
t.id,
|
|
69
|
+
{
|
|
70
|
+
config: t,
|
|
71
|
+
registry: new AgentRegistry(t.orchestrator, t.workers, deps),
|
|
72
|
+
},
|
|
73
|
+
]));
|
|
74
|
+
}
|
|
75
|
+
/** Find which team owns an orchestrator ID. */
|
|
76
|
+
resolveTeam(orchestratorId) {
|
|
77
|
+
for (const [teamId, { config, registry }] of this.teams) {
|
|
78
|
+
if (config.orchestrator.id === orchestratorId) {
|
|
79
|
+
return { teamId, registry };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/** Get registry for a specific team by teamId. */
|
|
85
|
+
getTeamRegistry(teamId) {
|
|
86
|
+
return this.teams.get(teamId)?.registry ?? null;
|
|
87
|
+
}
|
|
88
|
+
/** All teams for UI picker. */
|
|
89
|
+
listTeams() {
|
|
90
|
+
return [...this.teams.values()].map(({ config }) => ({
|
|
91
|
+
id: config.id,
|
|
92
|
+
name: config.name ?? config.id,
|
|
93
|
+
color: config.color ?? "",
|
|
94
|
+
orchestratorId: config.orchestrator.id,
|
|
95
|
+
orchestratorIdentity: config.orchestrator.identity,
|
|
96
|
+
orchestratorModel: parseModel(config.orchestrator.model).modelId,
|
|
97
|
+
workerCount: config.workers.length,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
/** True if any team has workers. */
|
|
101
|
+
hasWorkers() {
|
|
102
|
+
for (const { config } of this.teams.values()) {
|
|
103
|
+
if (config.workers.length > 0)
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Parse "provider:modelId" string. */
|
|
110
|
+
export function parseModel(raw) {
|
|
111
|
+
const [provider, ...rest] = raw.split(":");
|
|
112
|
+
return { provider, modelId: rest.join(":") };
|
|
113
|
+
}
|
|
114
|
+
/** Return only the tools whose names are in the allowlist, or all if allowlist is empty. */
|
|
115
|
+
function filterTools(base, allowlist) {
|
|
116
|
+
if (allowlist.length === 0)
|
|
117
|
+
return { ...base };
|
|
118
|
+
const filtered = {};
|
|
119
|
+
for (const name of allowlist) {
|
|
120
|
+
if (name in base)
|
|
121
|
+
filtered[name] = base[name];
|
|
122
|
+
}
|
|
123
|
+
return filtered;
|
|
124
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { ToolSet } from "ai";
|
|
2
|
+
import type { IncomingMessage, Channel } from "../channels/types.js";
|
|
3
|
+
import type { Config } from "../config.js";
|
|
4
|
+
import type { ConfigStore } from "../config/store.js";
|
|
5
|
+
import type { MemoryStore } from "../memory/store.js";
|
|
6
|
+
import type { EmbeddingProvider } from "../memory/embedding.js";
|
|
7
|
+
import { Session } from "./session.js";
|
|
8
|
+
import { SessionStore } from "./session-store.js";
|
|
9
|
+
import type { DockerSandbox } from "../security/docker-sandbox.js";
|
|
10
|
+
import type { SkillManager } from "../skills/loader.js";
|
|
11
|
+
import { IntegrationRegistry } from "../integrations/registry.js";
|
|
12
|
+
import type { ScheduleStore } from "../scheduler/store.js";
|
|
13
|
+
import type { ConnectedChannelRegistry } from "../scheduler/connected-channels.js";
|
|
14
|
+
import type { TaskStore } from "../tasks/store.js";
|
|
15
|
+
import type { TeamStore } from "../teams/store.js";
|
|
16
|
+
import type { DesktopAdapter } from "../computer/desktop/adapter.js";
|
|
17
|
+
import type { BrowserManager } from "../computer/browser/manager.js";
|
|
18
|
+
import { ChannelStore } from "./channel-store.js";
|
|
19
|
+
import { DelegationStore } from "./delegation-store.js";
|
|
20
|
+
import { type TeamInfo } from "./agent-registry.js";
|
|
21
|
+
import { ChannelManager } from "../channels/manager.js";
|
|
22
|
+
export interface AgentDeps {
|
|
23
|
+
config: Config;
|
|
24
|
+
configStore: ConfigStore;
|
|
25
|
+
tools: ToolSet;
|
|
26
|
+
dataDir: string;
|
|
27
|
+
memoryStore?: MemoryStore | null;
|
|
28
|
+
embeddingProvider?: EmbeddingProvider | null;
|
|
29
|
+
sandbox?: DockerSandbox | null;
|
|
30
|
+
skillManager?: SkillManager;
|
|
31
|
+
integrationRegistry?: IntegrationRegistry;
|
|
32
|
+
scheduleStore?: ScheduleStore | null;
|
|
33
|
+
taskStore?: TaskStore | null;
|
|
34
|
+
desktopAdapter?: DesktopAdapter | null;
|
|
35
|
+
browserManager?: BrowserManager | null;
|
|
36
|
+
delegationStore?: DelegationStore | null;
|
|
37
|
+
channelStore?: ChannelStore | null;
|
|
38
|
+
teamStore?: TeamStore | null;
|
|
39
|
+
channelManager?: ChannelManager | null;
|
|
40
|
+
connectedChannels?: ConnectedChannelRegistry | null;
|
|
41
|
+
}
|
|
42
|
+
export declare class Agent {
|
|
43
|
+
private sessions;
|
|
44
|
+
private sessionStore;
|
|
45
|
+
private queue;
|
|
46
|
+
private model;
|
|
47
|
+
private modelId;
|
|
48
|
+
private identity;
|
|
49
|
+
private language;
|
|
50
|
+
private tools;
|
|
51
|
+
private modelDef;
|
|
52
|
+
private memoryStore;
|
|
53
|
+
private embeddingProvider;
|
|
54
|
+
private memoryMaxResults;
|
|
55
|
+
private config;
|
|
56
|
+
private configStore;
|
|
57
|
+
private sandbox;
|
|
58
|
+
private skillManager;
|
|
59
|
+
private integrationRegistry;
|
|
60
|
+
private scheduleStore;
|
|
61
|
+
private taskStore;
|
|
62
|
+
private desktopAdapter;
|
|
63
|
+
private browserManager;
|
|
64
|
+
private teamRegistry;
|
|
65
|
+
private delegationStore;
|
|
66
|
+
private channelStore;
|
|
67
|
+
private teamStore;
|
|
68
|
+
private channelManager;
|
|
69
|
+
private connectedChannels;
|
|
70
|
+
private lastConfigMtime;
|
|
71
|
+
private teamRegistryDirty;
|
|
72
|
+
private newSessionPending;
|
|
73
|
+
private unsubTeamChange;
|
|
74
|
+
private memoryExtractor;
|
|
75
|
+
private workerCoordinator;
|
|
76
|
+
/** Cleanup functions for HTTP MCP servers (keyed by session key). */
|
|
77
|
+
private mcpCleanups;
|
|
78
|
+
constructor(deps: AgentDeps);
|
|
79
|
+
/** Force an immediate config reload + channel reconciliation. */
|
|
80
|
+
forceConfigReload(): Promise<void>;
|
|
81
|
+
getSession(key: string): Session | undefined;
|
|
82
|
+
getStore(): SessionStore;
|
|
83
|
+
/** Called from channels (Telegram, Discord, etc.) */
|
|
84
|
+
handleMessage(msg: IncomingMessage, channel: Channel, agentId?: string): Promise<void>;
|
|
85
|
+
/** Deliver reply as text or voice based on TTS reply mode. */
|
|
86
|
+
private deliverReply;
|
|
87
|
+
/** Called from gateway RPC (WebSocket UI) */
|
|
88
|
+
handleGatewayMessage(sessionKey: string, text: string, agentId?: string): Promise<string>;
|
|
89
|
+
/** Validate and bind an agentId to an existing session state. */
|
|
90
|
+
private applyAgentBinding;
|
|
91
|
+
/** Return teams for the UI picker. Reads from TeamStore for immediate visibility. */
|
|
92
|
+
getTeams(): TeamInfo[];
|
|
93
|
+
/** Abort current run for a session. */
|
|
94
|
+
abortSession(sessionKey: string): boolean;
|
|
95
|
+
/** Clear conversation history (memories are preserved across clears). */
|
|
96
|
+
clearSession(sessionKey: string): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Run a scheduled task in a persistent scheduler session. Returns the raw LLM reply.
|
|
99
|
+
* Serialized through the message queue to avoid races with human messages.
|
|
100
|
+
* The caller (Scheduler) handles [SKIP] detection and channel delivery.
|
|
101
|
+
*/
|
|
102
|
+
runScheduledTask(opts: {
|
|
103
|
+
prompt: string;
|
|
104
|
+
teamId: string;
|
|
105
|
+
integrations: string[];
|
|
106
|
+
}): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Handle a human message sent to the scheduler session.
|
|
109
|
+
* Serialized via the message queue to avoid overlap with scheduled task executions.
|
|
110
|
+
*/
|
|
111
|
+
handleSchedulerMessage(teamId: string, text: string, senderInfo?: string): Promise<string>;
|
|
112
|
+
/** Get the scheduler session for a team (for history display). */
|
|
113
|
+
getSchedulerSession(teamId: string): Session | undefined;
|
|
114
|
+
/** Start initial channels based on current config. Called once at boot. */
|
|
115
|
+
initChannels(): Promise<void>;
|
|
116
|
+
/** Clean up sandbox containers. */
|
|
117
|
+
cleanupSandbox(): void;
|
|
118
|
+
/** Extract remaining facts from all active sessions (call before shutdown). */
|
|
119
|
+
flushMemories(): Promise<void>;
|
|
120
|
+
private getOrCreateSession;
|
|
121
|
+
/** Build tools, adapt for MCP providers, and run the inference loop. */
|
|
122
|
+
private buildAdaptAndRun;
|
|
123
|
+
/** Build the RunToolsDeps from current agent state (agentRegistry filled per-call). */
|
|
124
|
+
private buildRunToolsDeps;
|
|
125
|
+
/** Return all tool names available in the current config (for UI discovery). */
|
|
126
|
+
getToolNames(): string[];
|
|
127
|
+
/** Run the loop with compaction retries on context overflow. */
|
|
128
|
+
private runLoopWithRetry;
|
|
129
|
+
/** (Re)build team registry from TeamStore (or skip if no store). */
|
|
130
|
+
private rebuildTeamRegistry;
|
|
131
|
+
/** Reload config from disk so API key / model changes take effect immediately. */
|
|
132
|
+
private reloadConfig;
|
|
133
|
+
/**
|
|
134
|
+
* Build channel specs from config and reconcile with ChannelManager.
|
|
135
|
+
* Handlers use dynamic orchestrator lookup (reads this.config at call time)
|
|
136
|
+
* so orchestrator-only changes don't require a channel restart.
|
|
137
|
+
*/
|
|
138
|
+
private reconcileChannels;
|
|
139
|
+
/** Resolve a human-readable team label for logs/console (name preferred, falls back to ID). */
|
|
140
|
+
private teamLabel;
|
|
141
|
+
/** Build a human-readable session label for logs: replaces team UUID with team name. */
|
|
142
|
+
private sessionLabel;
|
|
143
|
+
/** Enrich session index entry with team/agent name metadata for UI display. */
|
|
144
|
+
private enrichSessionMetadata;
|
|
145
|
+
private main;
|
|
146
|
+
}
|