dank-ai 1.0.1 → 1.0.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/README.md +66 -1290
- package/docker/package-lock.json +2899 -0
- package/docker/package.json +7 -6
- package/lib/agent.js +14 -19
- package/lib/cli/init.js +52 -7
- package/lib/project.js +16 -4
- package/package.json +51 -50
package/docker/package.json
CHANGED
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
"description": "Runtime dependencies for Dank agents",
|
|
5
5
|
"private": true,
|
|
6
6
|
"dependencies": {
|
|
7
|
+
"@anthropic-ai/sdk": "^0.6.0",
|
|
7
8
|
"axios": "^1.5.0",
|
|
8
|
-
"
|
|
9
|
-
"winston": "^3.10.0",
|
|
9
|
+
"cohere-ai": "^7.0.0",
|
|
10
10
|
"dotenv": "^16.3.1",
|
|
11
|
+
"express": "^4.18.2",
|
|
12
|
+
"express-rate-limit": "^6.8.1",
|
|
11
13
|
"lodash": "^4.17.21",
|
|
12
|
-
"uuid": "^9.0.0",
|
|
13
14
|
"moment": "^2.29.4",
|
|
14
15
|
"openai": "^4.0.0",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"uuid": "^9.0.0",
|
|
17
|
+
"winston": "^3.10.0",
|
|
18
|
+
"ws": "^8.18.3"
|
|
18
19
|
}
|
|
19
20
|
}
|
package/lib/agent.js
CHANGED
|
@@ -110,39 +110,34 @@ class DankAgent {
|
|
|
110
110
|
return this;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* Set the main port that the agent will expose
|
|
115
|
-
*/
|
|
116
|
-
setPort(port) {
|
|
117
|
-
if (typeof port !== 'number' || port < 1000 || port > 65535) {
|
|
118
|
-
throw new Error('Port must be a number between 1000 and 65535');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
this.config.docker = { ...this.config.docker, port };
|
|
122
|
-
return this;
|
|
123
|
-
}
|
|
124
113
|
|
|
125
114
|
/**
|
|
126
|
-
*
|
|
115
|
+
* Configure prompting server settings
|
|
127
116
|
*/
|
|
128
|
-
|
|
117
|
+
setPromptingServer(options = {}) {
|
|
129
118
|
const schema = Joi.object({
|
|
130
|
-
protocol: Joi.string().valid('websocket', 'tcp', 'http').default('
|
|
119
|
+
protocol: Joi.string().valid('websocket', 'tcp', 'http').default('http'),
|
|
120
|
+
port: Joi.number().min(1000).max(65535).default(3000),
|
|
131
121
|
authentication: Joi.boolean().default(false),
|
|
132
|
-
maxConnections: Joi.number().min(1).max(1000).default(
|
|
122
|
+
maxConnections: Joi.number().min(1).max(1000).default(50),
|
|
133
123
|
timeout: Joi.number().min(1000).default(30000)
|
|
134
124
|
});
|
|
135
125
|
|
|
136
126
|
const { error, value } = schema.validate(options);
|
|
137
127
|
if (error) {
|
|
138
|
-
throw new Error(`Invalid
|
|
128
|
+
throw new Error(`Invalid prompting server configuration: ${error.message}`);
|
|
139
129
|
}
|
|
140
130
|
|
|
131
|
+
// Set the port in docker config
|
|
132
|
+
this.config.docker = { ...this.config.docker, port: value.port };
|
|
133
|
+
|
|
134
|
+
// Set the communication config (excluding port)
|
|
135
|
+
const { port, ...communicationConfig } = value;
|
|
141
136
|
this.config.communication = {
|
|
142
137
|
...this.config.communication,
|
|
143
138
|
directPrompting: {
|
|
144
139
|
enabled: true,
|
|
145
|
-
...
|
|
140
|
+
...communicationConfig
|
|
146
141
|
}
|
|
147
142
|
};
|
|
148
143
|
|
|
@@ -568,9 +563,9 @@ class DankAgent {
|
|
|
568
563
|
communication: Joi.object({
|
|
569
564
|
directPrompting: Joi.object({
|
|
570
565
|
enabled: Joi.boolean().default(false),
|
|
571
|
-
protocol: Joi.string().valid('websocket', 'tcp', 'http').default('
|
|
566
|
+
protocol: Joi.string().valid('websocket', 'tcp', 'http').default('http'),
|
|
572
567
|
authentication: Joi.boolean().default(false),
|
|
573
|
-
maxConnections: Joi.number().min(1).max(1000).default(
|
|
568
|
+
maxConnections: Joi.number().min(1).max(1000).default(50),
|
|
574
569
|
timeout: Joi.number().min(1000).default(30000)
|
|
575
570
|
}).default({ enabled: false }),
|
|
576
571
|
httpApi: Joi.object({
|
package/lib/cli/init.js
CHANGED
|
@@ -8,9 +8,54 @@ const chalk = require('chalk');
|
|
|
8
8
|
const { DankProject } = require('../project');
|
|
9
9
|
|
|
10
10
|
async function initCommand(projectName, options) {
|
|
11
|
-
|
|
11
|
+
let name = projectName;
|
|
12
|
+
let npmProjectName = projectName;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
// If no project name provided, prompt for both directory name and npm project name
|
|
15
|
+
if (!name) {
|
|
16
|
+
const inquirer = await import('inquirer');
|
|
17
|
+
const answers = await inquirer.default.prompt([
|
|
18
|
+
{
|
|
19
|
+
type: 'input',
|
|
20
|
+
name: 'projectName',
|
|
21
|
+
message: 'What should the project directory be named?',
|
|
22
|
+
default: path.basename(process.cwd()),
|
|
23
|
+
validate: (input) => {
|
|
24
|
+
if (!input.trim()) {
|
|
25
|
+
return 'Project name is required';
|
|
26
|
+
}
|
|
27
|
+
if (!/^[a-zA-Z0-9-_]+$/.test(input)) {
|
|
28
|
+
return 'Project name can only contain letters, numbers, hyphens, and underscores';
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'input',
|
|
35
|
+
name: 'npmProjectName',
|
|
36
|
+
message: 'What should the npm package name be?',
|
|
37
|
+
default: (answers) => answers.projectName.toLowerCase().replace(/[^a-z0-9-]/g, '-'),
|
|
38
|
+
validate: (input) => {
|
|
39
|
+
if (!input.trim()) {
|
|
40
|
+
return 'NPM project name is required';
|
|
41
|
+
}
|
|
42
|
+
if (!/^[a-z0-9-]+$/.test(input)) {
|
|
43
|
+
return 'NPM project name can only contain lowercase letters, numbers, and hyphens';
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
name = answers.projectName;
|
|
51
|
+
npmProjectName = answers.npmProjectName;
|
|
52
|
+
} else {
|
|
53
|
+
// If project name provided, use it for both directory and npm name
|
|
54
|
+
npmProjectName = name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(chalk.yellow(`🚀 Initializing Dank project: ${name}`));
|
|
58
|
+
console.log(chalk.cyan(`📦 NPM package name: ${npmProjectName}\n`));
|
|
14
59
|
|
|
15
60
|
try {
|
|
16
61
|
// Create project instance
|
|
@@ -23,7 +68,7 @@ async function initCommand(projectName, options) {
|
|
|
23
68
|
await project.init();
|
|
24
69
|
|
|
25
70
|
// Create package.json
|
|
26
|
-
await createPackageJson(
|
|
71
|
+
await createPackageJson(npmProjectName, project.projectPath);
|
|
27
72
|
|
|
28
73
|
// Create .env.example file
|
|
29
74
|
await createEnvExample(project.projectPath);
|
|
@@ -51,11 +96,11 @@ async function initCommand(projectName, options) {
|
|
|
51
96
|
/**
|
|
52
97
|
* Create package.json for the new project
|
|
53
98
|
*/
|
|
54
|
-
async function createPackageJson(
|
|
99
|
+
async function createPackageJson(npmProjectName, projectPath) {
|
|
55
100
|
const packageJson = {
|
|
56
|
-
name:
|
|
101
|
+
name: npmProjectName,
|
|
57
102
|
version: '1.0.0',
|
|
58
|
-
description: `Dank AI agents for ${
|
|
103
|
+
description: `Dank AI agents for ${npmProjectName}`,
|
|
59
104
|
main: 'dank.config.js',
|
|
60
105
|
scripts: {
|
|
61
106
|
start: 'dank run',
|
|
@@ -67,7 +112,7 @@ async function createPackageJson(projectName, projectPath) {
|
|
|
67
112
|
clean: 'dank clean'
|
|
68
113
|
},
|
|
69
114
|
dependencies: {
|
|
70
|
-
'dank': '^1.0.0'
|
|
115
|
+
'dank-ai': '^1.0.0'
|
|
71
116
|
},
|
|
72
117
|
keywords: ['dank', 'ai', 'agents', 'automation', 'llm'],
|
|
73
118
|
author: '',
|
package/lib/project.js
CHANGED
|
@@ -215,7 +215,10 @@ module.exports = {
|
|
|
215
215
|
})
|
|
216
216
|
.setPrompt('You are a helpful AI assistant. Be concise and friendly in your responses.')
|
|
217
217
|
.setBaseImage('nodejs-20')
|
|
218
|
-
.
|
|
218
|
+
.setPromptingServer({
|
|
219
|
+
protocol: 'http',
|
|
220
|
+
port: 3000
|
|
221
|
+
})
|
|
219
222
|
.setResources({
|
|
220
223
|
memory: '512m',
|
|
221
224
|
cpu: 1
|
|
@@ -278,7 +281,10 @@ module.exports = {
|
|
|
278
281
|
})
|
|
279
282
|
.setPrompt('You are a specialized API assistant that helps with data processing and analysis.')
|
|
280
283
|
.setBaseImage('nodejs-20')
|
|
281
|
-
.
|
|
284
|
+
.setPromptingServer({
|
|
285
|
+
protocol: 'http',
|
|
286
|
+
port: 3001
|
|
287
|
+
})
|
|
282
288
|
.setResources({
|
|
283
289
|
memory: '1g',
|
|
284
290
|
cpu: 2
|
|
@@ -344,7 +350,10 @@ module.exports = {
|
|
|
344
350
|
})
|
|
345
351
|
.setPrompt('You are a versatile AI assistant that can handle both direct prompts and API requests. You excel at creative tasks and problem-solving.')
|
|
346
352
|
.setBaseImage('nodejs-20')
|
|
347
|
-
.
|
|
353
|
+
.setPromptingServer({
|
|
354
|
+
protocol: 'http',
|
|
355
|
+
port: 3002
|
|
356
|
+
})
|
|
348
357
|
.setResources({
|
|
349
358
|
memory: '2g',
|
|
350
359
|
cpu: 2
|
|
@@ -422,7 +431,10 @@ const exampleAgent = createAgent('example-agent')
|
|
|
422
431
|
- Help with problem-solving and creative tasks
|
|
423
432
|
\`)
|
|
424
433
|
.setBaseImage('nodejs-20')
|
|
425
|
-
.
|
|
434
|
+
.setPromptingServer({
|
|
435
|
+
protocol: 'http',
|
|
436
|
+
port: 3000
|
|
437
|
+
})
|
|
426
438
|
.setResources({
|
|
427
439
|
memory: '512m',
|
|
428
440
|
cpu: 1,
|
package/package.json
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
2
|
+
"name": "dank-ai",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Dank AI",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dank": "bin/dank"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "dank run",
|
|
11
|
+
"dev": "dank run --config dank.config.js",
|
|
12
|
+
"stop": "dank stop",
|
|
13
|
+
"status": "dank status",
|
|
14
|
+
"logs": "dank logs",
|
|
15
|
+
"build": "dank build",
|
|
16
|
+
"clean": "dank clean"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"commander": "^11.0.0",
|
|
20
|
+
"chalk": "^4.1.2",
|
|
21
|
+
"dockerode": "^4.0.0",
|
|
22
|
+
"js-yaml": "^4.1.0",
|
|
23
|
+
"joi": "^17.9.2",
|
|
24
|
+
"winston": "^3.10.0",
|
|
25
|
+
"fs-extra": "^11.1.1",
|
|
26
|
+
"tar": "^6.1.15",
|
|
27
|
+
"uuid": "^9.0.0",
|
|
28
|
+
"inquirer": "^9.2.12"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"dank",
|
|
32
|
+
"ai",
|
|
33
|
+
"agents",
|
|
34
|
+
"automation",
|
|
35
|
+
"llm"
|
|
36
|
+
],
|
|
37
|
+
"author": "",
|
|
38
|
+
"license": "ISC",
|
|
39
|
+
"files": [
|
|
40
|
+
"lib/",
|
|
41
|
+
"bin/",
|
|
42
|
+
"docker/",
|
|
43
|
+
"templates/",
|
|
44
|
+
"README.md"
|
|
45
|
+
],
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=16.0.0",
|
|
48
|
+
"npm": ">=8.0.0"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
}
|
|
52
53
|
}
|