dank-ai 1.0.33 → 1.0.34

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 CHANGED
@@ -526,7 +526,6 @@ agent
526
526
  prompt: "User's input prompt",
527
527
  response: "LLM's response",
528
528
  conversationId: "unique-conversation-id",
529
- context: { protocol: "http" },
530
529
  usage: { total_tokens: 150, prompt_tokens: 50, completion_tokens: 100 },
531
530
  model: "gpt-3.5-turbo",
532
531
  processingTime: 1250,
@@ -737,7 +736,7 @@ dank build:prod --config production.config.js --output-metadata deployment.json
737
736
 
738
737
  The `--output-metadata` option generates a JSON file containing all deployment information needed for your backend infrastructure:
739
738
  - **Base image** used (`setBaseImage()` value)
740
- - **Prompting server** configuration (protocol, port, authentication, maxConnections)
739
+ - **Prompting server** configuration (port, authentication, maxConnections)
741
740
  - **Resource limits** (memory, CPU, timeout)
742
741
  - **Ports** that need to be opened
743
742
  - **Features enabled** (direct prompting, HTTP API, event handlers)
@@ -776,7 +775,6 @@ This metadata file is perfect for CI/CD pipelines to automatically configure you
776
775
  "ports": [
777
776
  {
778
777
  "port": 3000,
779
- "protocol": "http",
780
778
  "description": "Direct prompting server"
781
779
  }
782
780
  ],
package/lib/agent.js CHANGED
@@ -64,7 +64,7 @@ class DankAgent {
64
64
  }
65
65
 
66
66
  /**
67
- * Set instance type (small, medium, large, xlarge)
67
+ * Set instance type (any string value - validated by backend)
68
68
  * @param {string} instanceType - Instance type string
69
69
  */
70
70
  setInstanceType(instanceType) {
@@ -72,14 +72,8 @@ class DankAgent {
72
72
  throw new Error('Instance type must be a non-empty string');
73
73
  }
74
74
 
75
- const normalizedType = instanceType.toLowerCase().trim();
76
-
77
- if (!INSTANCE_TYPES[normalizedType]) {
78
- const validTypes = Object.keys(INSTANCE_TYPES).join(', ');
79
- throw new Error(`Invalid instance type: "${instanceType}". Valid types are: ${validTypes}`);
80
- }
81
-
82
- this.config.instanceType = normalizedType;
75
+ // Store the instance type as-is (no validation - backend handles valid types)
76
+ this.config.instanceType = instanceType.trim();
83
77
  return this;
84
78
  }
85
79
 
@@ -159,19 +153,25 @@ class DankAgent {
159
153
  port: Joi.number().min(1000).max(65535).default(3000),
160
154
  authentication: Joi.boolean().default(false),
161
155
  maxConnections: Joi.number().min(1).max(1000).default(50),
162
- timeout: Joi.number().min(1000).default(30000)
156
+ timeout: Joi.number().min(1000).default(30000),
157
+ protocol: Joi.string().valid('http').optional() // Allow but ignore for backward compatibility
163
158
  });
164
159
 
165
- const { error, value } = schema.validate(options);
160
+ const { error, value } = schema.validate(options, {
161
+ stripUnknown: true // Strip unknown fields after validation
162
+ });
166
163
  if (error) {
167
164
  throw new Error(`Invalid prompting server configuration: ${error.message}`);
168
165
  }
166
+
167
+ // Remove protocol from value if present (we always use HTTP now)
168
+ const { protocol, ...cleanValue } = value;
169
169
 
170
170
  // Set the port in docker config
171
- this.config.docker = { ...this.config.docker, port: value.port };
171
+ this.config.docker = { ...this.config.docker, port: cleanValue.port };
172
172
 
173
173
  // Set the communication config (always HTTP, excluding port)
174
- const { port, ...communicationConfig } = value;
174
+ const { port, ...communicationConfig } = cleanValue;
175
175
  this.config.communication = {
176
176
  ...this.config.communication,
177
177
  directPrompting: {
@@ -649,7 +649,7 @@ class DankAgent {
649
649
 
650
650
  prompt: Joi.string().optional(),
651
651
 
652
- instanceType: Joi.string().valid('small', 'medium', 'large', 'xlarge').default('small'),
652
+ instanceType: Joi.string().default('small'), // Any string allowed - backend validates
653
653
 
654
654
  docker: Joi.object({
655
655
  baseImage: Joi.string().default(`${DOCKER_CONFIG.baseImagePrefix}:${DOCKER_CONFIG.defaultTag}`),
package/lib/config.js CHANGED
@@ -77,15 +77,17 @@ class AgentConfig {
77
77
 
78
78
  /**
79
79
  * Get resources (memory, cpu) from instance type
80
- * @param {string} instanceType - Instance type (small, medium, large, xlarge)
80
+ * @param {string} instanceType - Instance type (any string, defaults to 'small' if not found)
81
81
  * @returns {Object} Resources object with memory and cpu
82
82
  */
83
83
  static getResourcesFromInstanceType(instanceType) {
84
84
  const normalizedType = (instanceType || 'small').toLowerCase().trim();
85
85
  const instanceConfig = INSTANCE_TYPES[normalizedType];
86
86
 
87
+ // If instance type not found in mapping, default to 'small'
88
+ // Backend will handle the actual resource allocation
87
89
  if (!instanceConfig) {
88
- throw new Error(`Invalid instance type: "${instanceType}". Valid types are: ${Object.keys(INSTANCE_TYPES).join(', ')}`);
90
+ return INSTANCE_TYPES.small; // Default to small resources
89
91
  }
90
92
 
91
93
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dank-ai",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "description": "Dank Agent Service - Docker-based AI agent orchestration platform",
5
5
  "main": "lib/index.js",
6
6
  "exports": {