@ai.ntellect/core 0.4.1 → 0.6.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/.mocharc.json +1 -1
- package/README.md +311 -272
- package/dist/graph/controller.js +63 -0
- package/dist/graph/engine.js +563 -0
- package/dist/index.js +6 -6
- package/dist/memory/adapters/meilisearch/index.js +249 -0
- package/dist/memory/adapters/redis/index.js +96 -0
- package/dist/memory/index.js +9 -0
- package/dist/services/agenda.js +115 -0
- package/dist/services/embedding.js +40 -0
- package/dist/services/queue.js +99 -103
- package/dist/test/graph/controller.test.js +170 -0
- package/dist/test/graph/engine.test.js +465 -0
- package/dist/test/memory/adapters/meilisearch.test.js +250 -0
- package/dist/test/memory/adapters/redis.test.js +143 -0
- package/dist/test/memory/base.test.js +209 -0
- package/dist/test/services/agenda.test.js +230 -0
- package/dist/test/services/queue.test.js +258 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/generate-object.js +32 -11
- package/dist/utils/inject-actions.js +2 -2
- package/dist/utils/queue-item-transformer.js +2 -2
- package/dist/utils/state-manager.js +20 -0
- package/graph/controller.ts +60 -0
- package/graph/engine.ts +709 -0
- package/index.ts +7 -7
- package/interfaces/index.ts +119 -0
- package/memory/adapters/meilisearch/index.ts +286 -0
- package/memory/adapters/redis/index.ts +103 -0
- package/memory/index.ts +22 -0
- package/package.json +9 -2
- package/services/agenda.ts +118 -0
- package/services/embedding.ts +26 -0
- package/services/queue.ts +5 -32
- package/test/.env.test +4 -0
- package/test/graph/controller.test.ts +186 -0
- package/test/graph/engine.test.ts +563 -0
- package/test/memory/adapters/meilisearch.test.ts +297 -0
- package/test/memory/adapters/redis.test.ts +160 -0
- package/test/memory/base.test.ts +229 -0
- package/test/services/agenda.test.ts +280 -0
- package/test/services/queue.test.ts +286 -44
- package/tsconfig.json +10 -9
- package/types/index.ts +270 -0
- package/utils/generate-object.js +111 -0
- package/utils/generate-object.ts +24 -12
- package/utils/header-builder.js +34 -0
- package/utils/inject-actions.js +16 -0
- package/utils/inject-actions.ts +3 -3
- package/utils/queue-item-transformer.js +24 -0
- package/utils/queue-item-transformer.ts +8 -11
- package/utils/sanitize-results.js +60 -0
- package/utils/schema-generator.js +46 -0
- package/utils/state-manager.js +20 -0
- package/utils/state-manager.ts +30 -0
- package/.nvmrc +0 -1
- package/README.FR.md +0 -365
- package/agent/index.ts +0 -244
- package/agent/tools/get-rss.ts +0 -64
- package/bull.ts +0 -5
- package/dist/agent/index.d.ts +0 -38
- package/dist/agent/index.js +0 -143
- package/dist/agent/tools/get-rss.d.ts +0 -16
- package/dist/agent/tools/get-rss.js +0 -62
- package/dist/bull.d.ts +0 -1
- package/dist/bull.js +0 -9
- package/dist/examples/index.d.ts +0 -2
- package/dist/examples/index.js +0 -89
- package/dist/index.d.ts +0 -7
- package/dist/llm/interpreter/context.d.ts +0 -15
- package/dist/llm/interpreter/context.js +0 -89
- package/dist/llm/interpreter/index.d.ts +0 -21
- package/dist/llm/interpreter/index.js +0 -87
- package/dist/llm/memory-manager/context.d.ts +0 -2
- package/dist/llm/memory-manager/context.js +0 -22
- package/dist/llm/memory-manager/index.d.ts +0 -17
- package/dist/llm/memory-manager/index.js +0 -107
- package/dist/llm/orchestrator/context.d.ts +0 -2
- package/dist/llm/orchestrator/context.js +0 -23
- package/dist/llm/orchestrator/index.d.ts +0 -44
- package/dist/llm/orchestrator/index.js +0 -139
- package/dist/llm/orchestrator/types.d.ts +0 -12
- package/dist/memory/cache.d.ts +0 -22
- package/dist/memory/cache.js +0 -165
- package/dist/memory/persistent.d.ts +0 -57
- package/dist/memory/persistent.js +0 -189
- package/dist/services/queue.d.ts +0 -13
- package/dist/services/redis-cache.d.ts +0 -37
- package/dist/services/redis-cache.js +0 -93
- package/dist/services/scheduler.d.ts +0 -40
- package/dist/services/scheduler.js +0 -99
- package/dist/services/telegram-monitor.d.ts +0 -0
- package/dist/services/telegram-monitor.js +0 -118
- package/dist/t.d.ts +0 -46
- package/dist/t.js +0 -102
- package/dist/test.d.ts +0 -0
- package/dist/test.js +0 -438
- package/dist/types.d.ts +0 -258
- package/dist/types.js +0 -22
- package/dist/utils/generate-object.d.ts +0 -12
- package/dist/utils/header-builder.d.ts +0 -11
- package/dist/utils/inject-actions.d.ts +0 -2
- package/dist/utils/queue-item-transformer.d.ts +0 -7
- package/dist/utils/sanitize-results.d.ts +0 -17
- package/dist/utils/schema-generator.d.ts +0 -16
- package/examples/index.ts +0 -103
- package/llm/interpreter/context.ts +0 -101
- package/llm/interpreter/index.ts +0 -136
- package/llm/memory-manager/context.ts +0 -21
- package/llm/memory-manager/index.ts +0 -163
- package/llm/orchestrator/context.ts +0 -22
- package/llm/orchestrator/index.ts +0 -232
- package/llm/orchestrator/types.ts +0 -14
- package/memory/cache.ts +0 -221
- package/memory/persistent.ts +0 -265
- package/services/redis-cache.ts +0 -128
- package/services/scheduler.ts +0 -128
- package/services/telegram-monitor.ts +0 -138
- package/t.py +0 -79
- package/t.spec +0 -38
- package/t.ts +0 -133
- package/test/llm/orchestrator.test.ts +0 -47
- package/test/llm/synthesizer.test.ts +0 -31
- package/types.ts +0 -288
- /package/dist/{llm/orchestrator/types.js → interfaces/index.js} +0 -0
package/t.py
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import platform
|
3
|
-
import subprocess
|
4
|
-
import urllib.request
|
5
|
-
import sys
|
6
|
-
|
7
|
-
def download_meilisearch():
|
8
|
-
"""Download the Meilisearch binary for the current OS."""
|
9
|
-
print("Checking operating system...")
|
10
|
-
os_name = platform.system().lower()
|
11
|
-
if os_name == "windows":
|
12
|
-
binary_url = "https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch-windows-amd64.exe"
|
13
|
-
binary_name = "meilisearch.exe"
|
14
|
-
elif os_name == "darwin": # macOS
|
15
|
-
binary_url = "https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch-macos-amd64"
|
16
|
-
binary_name = "meilisearch"
|
17
|
-
elif os_name == "linux":
|
18
|
-
binary_url = "https://github.com/meilisearch/meilisearch/releases/latest/download/meilisearch-linux-amd64"
|
19
|
-
binary_name = "meilisearch"
|
20
|
-
else:
|
21
|
-
print(f"Unsupported operating system: {os_name}")
|
22
|
-
sys.exit(1)
|
23
|
-
|
24
|
-
# Download the binary
|
25
|
-
if not os.path.exists(binary_name):
|
26
|
-
print(f"Downloading Meilisearch binary for {os_name}...")
|
27
|
-
try:
|
28
|
-
urllib.request.urlretrieve(binary_url, binary_name)
|
29
|
-
print("Download complete.")
|
30
|
-
except Exception as e:
|
31
|
-
print(f"Failed to download Meilisearch: {e}")
|
32
|
-
sys.exit(1)
|
33
|
-
|
34
|
-
# Add execute permissions for Linux/macOS
|
35
|
-
if os_name != "windows":
|
36
|
-
os.chmod(binary_name, 0o755)
|
37
|
-
else:
|
38
|
-
print("Meilisearch binary already exists.")
|
39
|
-
|
40
|
-
return binary_name
|
41
|
-
|
42
|
-
|
43
|
-
def create_data_directory():
|
44
|
-
"""Create a directory for Meilisearch data if it doesn't exist."""
|
45
|
-
data_dir = "./data"
|
46
|
-
if not os.path.exists(data_dir):
|
47
|
-
print("Creating data directory...")
|
48
|
-
os.makedirs(data_dir)
|
49
|
-
else:
|
50
|
-
print("Data directory already exists.")
|
51
|
-
return data_dir
|
52
|
-
|
53
|
-
def launch_meilisearch(binary_name, data_dir):
|
54
|
-
"""Launch the Meilisearch server."""
|
55
|
-
print("Launching Meilisearch...")
|
56
|
-
try:
|
57
|
-
process = subprocess.Popen(
|
58
|
-
[
|
59
|
-
f"./{binary_name}" if platform.system().lower() != "windows" else binary_name,
|
60
|
-
"--db-path",
|
61
|
-
data_dir,
|
62
|
-
"--master-key",
|
63
|
-
"DEFAULT_MASTER_KEY",
|
64
|
-
],
|
65
|
-
stdout=subprocess.PIPE,
|
66
|
-
stderr=subprocess.PIPE,
|
67
|
-
)
|
68
|
-
print("Meilisearch is running! Access it at http://localhost:7700")
|
69
|
-
for line in iter(process.stdout.readline, b""):
|
70
|
-
print("Meilisearch Log:", line.decode().strip())
|
71
|
-
except Exception as e:
|
72
|
-
print(f"Failed to launch Meilisearch: {e}")
|
73
|
-
sys.exit(1)
|
74
|
-
|
75
|
-
|
76
|
-
if __name__ == "__main__":
|
77
|
-
binary = download_meilisearch()
|
78
|
-
data_directory = create_data_directory()
|
79
|
-
launch_meilisearch(binary, data_directory)
|
package/t.spec
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# -*- mode: python ; coding: utf-8 -*-
|
2
|
-
|
3
|
-
|
4
|
-
a = Analysis(
|
5
|
-
['t.py'],
|
6
|
-
pathex=[],
|
7
|
-
binaries=[],
|
8
|
-
datas=[],
|
9
|
-
hiddenimports=[],
|
10
|
-
hookspath=[],
|
11
|
-
hooksconfig={},
|
12
|
-
runtime_hooks=[],
|
13
|
-
excludes=[],
|
14
|
-
noarchive=False,
|
15
|
-
optimize=0,
|
16
|
-
)
|
17
|
-
pyz = PYZ(a.pure)
|
18
|
-
|
19
|
-
exe = EXE(
|
20
|
-
pyz,
|
21
|
-
a.scripts,
|
22
|
-
a.binaries,
|
23
|
-
a.datas,
|
24
|
-
[],
|
25
|
-
name='t',
|
26
|
-
debug=False,
|
27
|
-
bootloader_ignore_signals=False,
|
28
|
-
strip=False,
|
29
|
-
upx=True,
|
30
|
-
upx_exclude=[],
|
31
|
-
runtime_tmpdir=None,
|
32
|
-
console=True,
|
33
|
-
disable_windowed_traceback=False,
|
34
|
-
argv_emulation=False,
|
35
|
-
target_arch=None,
|
36
|
-
codesign_identity=None,
|
37
|
-
entitlements_file=None,
|
38
|
-
)
|
package/t.ts
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
export interface NetworkConfig {
|
2
|
-
name: string;
|
3
|
-
id?: number;
|
4
|
-
rpc: string;
|
5
|
-
explorerUrl: string;
|
6
|
-
nativeToken: string; // WETH
|
7
|
-
}
|
8
|
-
export const networkConfigs: Record<string, NetworkConfig> = {
|
9
|
-
ethereum: {
|
10
|
-
name: "Ethereum Mainnet",
|
11
|
-
id: 1,
|
12
|
-
rpc: "https://eth.llamarpc.com",
|
13
|
-
explorerUrl: "https://etherscan.io",
|
14
|
-
nativeToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
15
|
-
},
|
16
|
-
polygon: {
|
17
|
-
name: "Polygon Mainnet",
|
18
|
-
id: 137,
|
19
|
-
rpc: "https://polygon.llamarpc.com",
|
20
|
-
explorerUrl: "https://polygonscan.com",
|
21
|
-
nativeToken: "0x0000000000000000000000000000000000001010",
|
22
|
-
},
|
23
|
-
arbitrum: {
|
24
|
-
name: "Arbitrum Mainnet",
|
25
|
-
id: 42161,
|
26
|
-
rpc: "https://arbitrum.llamarpc.com",
|
27
|
-
explorerUrl: "https://arbiscan.io",
|
28
|
-
nativeToken: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
29
|
-
},
|
30
|
-
base: {
|
31
|
-
name: "Base Mainnet",
|
32
|
-
id: 8453,
|
33
|
-
rpc: "https://base.llamarpc.com",
|
34
|
-
explorerUrl: "https://basescan.org",
|
35
|
-
nativeToken: "0x4200000000000000000000000000000000000006",
|
36
|
-
},
|
37
|
-
solana: {
|
38
|
-
name: "Solana Mainnet",
|
39
|
-
rpc: "https://api.mainnet-beta.solana.com",
|
40
|
-
explorerUrl: "https://solscan.io",
|
41
|
-
nativeToken: "So11111111111111111111111111111111111111112",
|
42
|
-
},
|
43
|
-
sepolia: {
|
44
|
-
name: "Sepolia Testnet",
|
45
|
-
id: 11155111,
|
46
|
-
rpc: "https://sepolia.llamarpc.com",
|
47
|
-
explorerUrl: "https://sepolia.etherscan.io",
|
48
|
-
nativeToken: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",
|
49
|
-
},
|
50
|
-
baseSepolia: {
|
51
|
-
name: "Base Sepolia Testnet",
|
52
|
-
id: 84532,
|
53
|
-
rpc: "https://base-sepolia-rpc.publicnode.com",
|
54
|
-
explorerUrl: "https://sepolia.basescan.org",
|
55
|
-
nativeToken: "0x4200000000000000000000000000000000000006",
|
56
|
-
},
|
57
|
-
};
|
58
|
-
|
59
|
-
export const getNetworkProvider = (networkName: string) => {
|
60
|
-
const config = networkConfigs[networkName.toLowerCase()];
|
61
|
-
if (!config) {
|
62
|
-
throw new Error(`Network ${networkName} not supported`);
|
63
|
-
}
|
64
|
-
return { config };
|
65
|
-
};
|
66
|
-
|
67
|
-
import { parseEther } from "ethers";
|
68
|
-
import { z } from "zod";
|
69
|
-
|
70
|
-
export type TransactionPrepared = {
|
71
|
-
to: string;
|
72
|
-
value: string;
|
73
|
-
data?: string;
|
74
|
-
chain: {
|
75
|
-
id: number;
|
76
|
-
rpc: string;
|
77
|
-
};
|
78
|
-
type: "transfer" | "approve" | "swap";
|
79
|
-
method?: string;
|
80
|
-
params?: any[];
|
81
|
-
};
|
82
|
-
|
83
|
-
export const prepareEvmTransaction = {
|
84
|
-
name: "prepare-evm-transaction",
|
85
|
-
description: "Prepare a transaction for the user to sign.",
|
86
|
-
parameters: z.object({
|
87
|
-
walletAddress: z.string(),
|
88
|
-
amount: z
|
89
|
-
.string()
|
90
|
-
.describe("Ask the user for the amount to send, if not specified"),
|
91
|
-
network: z
|
92
|
-
.string()
|
93
|
-
.describe(
|
94
|
-
"Examples networks: ethereum, arbitrum, base. IMPORTANT: You must respect the network name."
|
95
|
-
),
|
96
|
-
}),
|
97
|
-
execute: async ({
|
98
|
-
walletAddress,
|
99
|
-
amount,
|
100
|
-
network,
|
101
|
-
}: {
|
102
|
-
walletAddress: string;
|
103
|
-
amount: string;
|
104
|
-
network: string;
|
105
|
-
}): Promise<TransactionPrepared> => {
|
106
|
-
try {
|
107
|
-
console.log("💰 Preparing transaction", {
|
108
|
-
to: walletAddress,
|
109
|
-
amount,
|
110
|
-
network,
|
111
|
-
});
|
112
|
-
|
113
|
-
const networkConfig = networkConfigs[network.toLowerCase()];
|
114
|
-
|
115
|
-
if (!networkConfig) {
|
116
|
-
throw new Error(`Network ${network} not found`);
|
117
|
-
}
|
118
|
-
|
119
|
-
return {
|
120
|
-
to: walletAddress,
|
121
|
-
value: parseEther(amount).toString(),
|
122
|
-
chain: {
|
123
|
-
id: networkConfig.id || 0,
|
124
|
-
rpc: networkConfig.rpc,
|
125
|
-
},
|
126
|
-
type: "transfer",
|
127
|
-
};
|
128
|
-
} catch (error) {
|
129
|
-
console.error("💰 Error sending transaction:", error);
|
130
|
-
throw new Error("An error occurred while sending the transaction");
|
131
|
-
}
|
132
|
-
},
|
133
|
-
};
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { expect } from "chai";
|
2
|
-
import { z } from "zod";
|
3
|
-
import { Orchestrator } from "../../llm/orchestrator";
|
4
|
-
import { ActionSchema } from "../../types";
|
5
|
-
|
6
|
-
describe("Orchestrator", () => {
|
7
|
-
let orchestrator: Orchestrator;
|
8
|
-
|
9
|
-
const mockAction: ActionSchema = {
|
10
|
-
name: "prepare-transaction",
|
11
|
-
description: "Prepare a transfer transaction",
|
12
|
-
parameters: z.object({
|
13
|
-
walletAddress: z.string(),
|
14
|
-
amount: z.string(),
|
15
|
-
networkId: z.string(),
|
16
|
-
}),
|
17
|
-
execute: async ({ walletAddress, amount, networkId }) => {
|
18
|
-
return { walletAddress, amount, networkId };
|
19
|
-
},
|
20
|
-
};
|
21
|
-
|
22
|
-
beforeEach(() => {
|
23
|
-
orchestrator = new Orchestrator([mockAction]);
|
24
|
-
});
|
25
|
-
|
26
|
-
it("should process a prompt and return just the answer", async function () {
|
27
|
-
this.timeout(10000);
|
28
|
-
|
29
|
-
const prompt = "Hello how are you?";
|
30
|
-
const result = await orchestrator.process(prompt);
|
31
|
-
|
32
|
-
expect(result).to.have.property("answer").that.is.a("string");
|
33
|
-
});
|
34
|
-
|
35
|
-
it("should process a prompt and return valid actions", async function () {
|
36
|
-
this.timeout(10000);
|
37
|
-
|
38
|
-
const prompt = "Send 0.1 ETH to 0x123...456 on ethereum";
|
39
|
-
const result = await orchestrator.process(prompt);
|
40
|
-
console.dir(result, { depth: null });
|
41
|
-
expect(result).to.have.property("actions").that.is.an("array");
|
42
|
-
expect(result).to.have.property("answer").that.is.a("string");
|
43
|
-
expect(result.actions[0])
|
44
|
-
.to.have.property("parameters")
|
45
|
-
.that.is.an("object");
|
46
|
-
});
|
47
|
-
});
|
@@ -1,31 +0,0 @@
|
|
1
|
-
// import { expect } from "chai";
|
2
|
-
// import { Summarizer } from "../../llm/synthesizer";
|
3
|
-
|
4
|
-
// describe("Synthesizer", () => {
|
5
|
-
// let synthesizer: Summarizer;
|
6
|
-
|
7
|
-
// beforeEach(() => {
|
8
|
-
// synthesizer = new Summarizer();
|
9
|
-
// });
|
10
|
-
|
11
|
-
// it("should process results and return a summary", async function () {
|
12
|
-
// this.timeout(10000);
|
13
|
-
|
14
|
-
// const mockResults = JSON.stringify({
|
15
|
-
// result: [
|
16
|
-
// {
|
17
|
-
// name: "prepare-transaction",
|
18
|
-
// result: {
|
19
|
-
// to: "0x123...456",
|
20
|
-
// value: "0.1",
|
21
|
-
// chain: { id: 1, name: "ethereum" },
|
22
|
-
// },
|
23
|
-
// },
|
24
|
-
// ],
|
25
|
-
// initialPrompt: "Send 0.1 ETH to 0x123...456 on ethereum",
|
26
|
-
// });
|
27
|
-
|
28
|
-
// const result = await synthesizer.process(mockResults);
|
29
|
-
// expect(result).to.have.property("response").that.is.a("string");
|
30
|
-
// });
|
31
|
-
// });
|
package/types.ts
DELETED
@@ -1,288 +0,0 @@
|
|
1
|
-
import { Embedding, EmbeddingModel, StreamTextResult } from "ai";
|
2
|
-
import { z } from "zod";
|
3
|
-
|
4
|
-
export interface BaseLLM {
|
5
|
-
process: (prompt: string) => Promise<string | object>;
|
6
|
-
streamProcess?: (
|
7
|
-
prompt: string
|
8
|
-
) => Promise<StreamTextResult<Record<string, any>>>;
|
9
|
-
}
|
10
|
-
|
11
|
-
export type User = {
|
12
|
-
id: string;
|
13
|
-
};
|
14
|
-
|
15
|
-
export interface QueueItem {
|
16
|
-
name: string;
|
17
|
-
parameters: QueueItemParameter[];
|
18
|
-
}
|
19
|
-
|
20
|
-
export interface IEventHandler {
|
21
|
-
emitQueueStart(actions: QueueItem[]): void;
|
22
|
-
emitActionStart(action: QueueItem): void;
|
23
|
-
emitActionComplete(action: QueueResult): void;
|
24
|
-
emitQueueComplete(): void;
|
25
|
-
}
|
26
|
-
|
27
|
-
export type AgentEvent = {
|
28
|
-
onMessage?: (data: any) => void;
|
29
|
-
onQueueStart?: (actions: QueueItem[]) => void;
|
30
|
-
onActionStart?: (action: QueueItem) => void;
|
31
|
-
onActionComplete?: (action: QueueResult) => void;
|
32
|
-
onQueueComplete?: (actions: QueueResult[]) => void;
|
33
|
-
onConfirmationRequired?: (message: string) => Promise<boolean>;
|
34
|
-
};
|
35
|
-
|
36
|
-
export interface QueueResult {
|
37
|
-
name: string;
|
38
|
-
parameters: Record<string, string>;
|
39
|
-
result: any;
|
40
|
-
error: string | null;
|
41
|
-
cancelled?: boolean;
|
42
|
-
}
|
43
|
-
|
44
|
-
export interface QueueCallbacks {
|
45
|
-
onActionStart?: (action: QueueItem) => void;
|
46
|
-
onActionComplete?: (result: QueueResult) => void;
|
47
|
-
onQueueComplete?: (results: QueueResult[]) => void;
|
48
|
-
onConfirmationRequired?: (message: string) => Promise<boolean>;
|
49
|
-
}
|
50
|
-
|
51
|
-
export interface ProcessPromptCallbacks {
|
52
|
-
onQueueStart?: (actions: QueueItem[]) => void | Promise<void>;
|
53
|
-
onActionStart?: (action: QueueItem) => void | Promise<void>;
|
54
|
-
onActionComplete?: (action: QueueResult) => void | Promise<void>;
|
55
|
-
onQueueComplete?: (actions: QueueResult[]) => void | Promise<void>;
|
56
|
-
onConfirmationRequired?: (message: string) => Promise<boolean>;
|
57
|
-
}
|
58
|
-
|
59
|
-
export type Behavior = {
|
60
|
-
role: string;
|
61
|
-
language: string;
|
62
|
-
guidelines: {
|
63
|
-
important: string[];
|
64
|
-
warnings: string[];
|
65
|
-
steps?: string[];
|
66
|
-
};
|
67
|
-
examplesMessages?: {
|
68
|
-
role: string;
|
69
|
-
content: string;
|
70
|
-
}[];
|
71
|
-
};
|
72
|
-
|
73
|
-
export type State = {
|
74
|
-
userRequest: string;
|
75
|
-
results: string;
|
76
|
-
};
|
77
|
-
|
78
|
-
export interface ActionSchema {
|
79
|
-
name: string;
|
80
|
-
description: string;
|
81
|
-
parameters: z.ZodObject<{
|
82
|
-
[key: string]: z.ZodType;
|
83
|
-
}>;
|
84
|
-
execute: (args: any) => Promise<any>;
|
85
|
-
examples?: {
|
86
|
-
role: string;
|
87
|
-
content: string;
|
88
|
-
parameters?: Record<string, any>;
|
89
|
-
}[];
|
90
|
-
confirmation?: {
|
91
|
-
requireConfirmation: boolean;
|
92
|
-
message: string;
|
93
|
-
};
|
94
|
-
}
|
95
|
-
|
96
|
-
export type ProcessPromptResult = {
|
97
|
-
type: "success" | "clarification" | "confirmation";
|
98
|
-
data:
|
99
|
-
| QueueResult[]
|
100
|
-
| {
|
101
|
-
validationErrors: string[];
|
102
|
-
prompt: string;
|
103
|
-
}
|
104
|
-
| {
|
105
|
-
actions: QueueItem[];
|
106
|
-
};
|
107
|
-
initialPrompt: string;
|
108
|
-
};
|
109
|
-
|
110
|
-
export interface ActionPattern {
|
111
|
-
id: string;
|
112
|
-
actions: QueueResult[];
|
113
|
-
embeddings: number[][];
|
114
|
-
queries: string[];
|
115
|
-
purpose: string;
|
116
|
-
}
|
117
|
-
|
118
|
-
export interface MatchOptions {
|
119
|
-
similarityThreshold?: number;
|
120
|
-
maxResults?: number;
|
121
|
-
}
|
122
|
-
|
123
|
-
export interface MatchResult {
|
124
|
-
data: any;
|
125
|
-
similarityPercentage: number;
|
126
|
-
purpose: string;
|
127
|
-
name?: string;
|
128
|
-
parameters?: Record<string, any>;
|
129
|
-
}
|
130
|
-
|
131
|
-
export interface SummarizerAgent {
|
132
|
-
process: (
|
133
|
-
results: object,
|
134
|
-
onFinish?: (event: any) => void
|
135
|
-
) => Promise<
|
136
|
-
| {
|
137
|
-
actions: { name: string; reasoning: string }[];
|
138
|
-
response: string;
|
139
|
-
}
|
140
|
-
| StreamTextResult<Record<string, any>>
|
141
|
-
>;
|
142
|
-
streamProcess: (
|
143
|
-
results: object,
|
144
|
-
onFinish?: (event: any) => void
|
145
|
-
) => Promise<StreamTextResult<Record<string, any>>>;
|
146
|
-
}
|
147
|
-
|
148
|
-
export interface CacheMemoryOptions {
|
149
|
-
embeddingModel: EmbeddingModel<string>;
|
150
|
-
cacheTTL?: number;
|
151
|
-
redisUrl?: string;
|
152
|
-
cachePrefix?: string;
|
153
|
-
}
|
154
|
-
|
155
|
-
export type GenerateObjectResponse = {
|
156
|
-
shouldContinue: boolean;
|
157
|
-
actions: Array<{
|
158
|
-
name: string;
|
159
|
-
parameters: Array<{
|
160
|
-
name: string;
|
161
|
-
value: any;
|
162
|
-
}>;
|
163
|
-
scheduler?: {
|
164
|
-
isScheduled: boolean;
|
165
|
-
cronExpression: string;
|
166
|
-
reason?: string;
|
167
|
-
};
|
168
|
-
}>;
|
169
|
-
socialResponse?: {
|
170
|
-
shouldRespond: boolean;
|
171
|
-
response?: string;
|
172
|
-
isPartialResponse?: boolean;
|
173
|
-
};
|
174
|
-
interpreter?: string;
|
175
|
-
};
|
176
|
-
|
177
|
-
export interface CreateMemoryInput {
|
178
|
-
query: string;
|
179
|
-
data: any;
|
180
|
-
userId?: string;
|
181
|
-
scope?: MemoryScope;
|
182
|
-
ttl?: number;
|
183
|
-
}
|
184
|
-
|
185
|
-
export interface CacheMemoryType {
|
186
|
-
id: string;
|
187
|
-
data: any;
|
188
|
-
query: string;
|
189
|
-
embedding: Embedding;
|
190
|
-
userId?: string;
|
191
|
-
scope: MemoryScope;
|
192
|
-
createdAt: Date;
|
193
|
-
}
|
194
|
-
|
195
|
-
export interface PersistentMemoryOptions {
|
196
|
-
host: string;
|
197
|
-
apiKey: string;
|
198
|
-
indexPrefix?: string;
|
199
|
-
}
|
200
|
-
|
201
|
-
export interface MemoryChunk {
|
202
|
-
content: string;
|
203
|
-
embedding: number[];
|
204
|
-
}
|
205
|
-
|
206
|
-
export type MemoryScopeType = (typeof MemoryScope)[keyof typeof MemoryScope];
|
207
|
-
|
208
|
-
export interface LongTermMemory {
|
209
|
-
id: string;
|
210
|
-
query: string;
|
211
|
-
category: string;
|
212
|
-
data: any;
|
213
|
-
roomId: string;
|
214
|
-
createdAt: Date;
|
215
|
-
chunks?: MemoryChunk[];
|
216
|
-
tags: string[];
|
217
|
-
}
|
218
|
-
|
219
|
-
export const ActionSchema = z.array(
|
220
|
-
z.object({
|
221
|
-
name: z.string(),
|
222
|
-
parameters: z.array(
|
223
|
-
z.object({
|
224
|
-
name: z.string(),
|
225
|
-
value: z.string(),
|
226
|
-
})
|
227
|
-
),
|
228
|
-
})
|
229
|
-
);
|
230
|
-
|
231
|
-
export enum MemoryType {
|
232
|
-
ACTION = "action",
|
233
|
-
CONVERSATION = "conversation",
|
234
|
-
KNOWLEDGE = "knowledge",
|
235
|
-
}
|
236
|
-
|
237
|
-
export enum MemoryScope {
|
238
|
-
GLOBAL = "global",
|
239
|
-
USER = "user",
|
240
|
-
}
|
241
|
-
|
242
|
-
export interface ActionData {
|
243
|
-
name?: string;
|
244
|
-
parameters?: Record<string, any>;
|
245
|
-
}
|
246
|
-
|
247
|
-
export interface QueueItemParameter {
|
248
|
-
name: string;
|
249
|
-
value: string;
|
250
|
-
}
|
251
|
-
|
252
|
-
export interface TransformedQueueItem {
|
253
|
-
name: string;
|
254
|
-
parameters: QueueItemParameter[];
|
255
|
-
}
|
256
|
-
|
257
|
-
export interface ScheduledAction {
|
258
|
-
id: string;
|
259
|
-
action: {
|
260
|
-
name: string;
|
261
|
-
parameters: QueueItemParameter[];
|
262
|
-
};
|
263
|
-
scheduledTime: Date;
|
264
|
-
userId: string;
|
265
|
-
status: "pending" | "completed" | "failed";
|
266
|
-
recurrence?: {
|
267
|
-
type: "daily" | "weekly" | "monthly";
|
268
|
-
interval: number;
|
269
|
-
};
|
270
|
-
}
|
271
|
-
|
272
|
-
export interface ScheduledActionEvents {
|
273
|
-
onActionStart?: (action: ScheduledAction) => void;
|
274
|
-
onActionComplete?: (action: ScheduledAction, result: any) => void;
|
275
|
-
onActionFailed?: (action: ScheduledAction, error: Error) => void;
|
276
|
-
onActionScheduled?: (action: ScheduledAction) => void;
|
277
|
-
onActionCancelled?: (actionId: string) => void;
|
278
|
-
}
|
279
|
-
|
280
|
-
export interface WorkflowPattern {
|
281
|
-
query: string;
|
282
|
-
actions: Array<{
|
283
|
-
done: boolean;
|
284
|
-
name: string;
|
285
|
-
result: string;
|
286
|
-
}>;
|
287
|
-
success: boolean;
|
288
|
-
}
|
File without changes
|