dank-ai 1.0.45 → 1.0.48

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
@@ -243,7 +243,7 @@ agent
243
243
 
244
244
  #### Passing Custom Data to Handlers
245
245
 
246
- You can pass any custom data in the request body to the `/prompt` endpoint, and it will be available in your handlers via `data.metadata`. This enables powerful use cases like user authentication, conversation tracking, RAG (Retrieval-Augmented Generation), and custom lookups.
246
+ You can pass any custom data in the request body to the `/prompt` endpoint, and it will be available in your handlers via `data.params`. This enables powerful use cases like user authentication, conversation tracking, RAG (Retrieval-Augmented Generation), and custom lookups.
247
247
 
248
248
  **Client Request:**
249
249
  ```javascript
@@ -264,9 +264,9 @@ You can pass any custom data in the request body to the `/prompt` endpoint, and
264
264
  ```javascript
265
265
  agent
266
266
  .addHandler('request_output:start', async (data) => {
267
- // Access custom data via data.metadata
268
- const userId = data.metadata.userId;
269
- const conversationId = data.metadata.conversationId;
267
+ // Access custom data via data.params
268
+ const userId = data.params.userId;
269
+ const conversationId = data.params.conversationId;
270
270
 
271
271
  // Perform authentication
272
272
  const user = await authenticateUser(userId);
@@ -287,16 +287,16 @@ agent
287
287
  .addHandler('request_output', async (data) => {
288
288
  // Log with user context
289
289
  await logInteraction({
290
- userId: data.metadata.userId,
291
- conversationId: data.metadata.conversationId,
290
+ userId: data.params.userId,
291
+ conversationId: data.params.conversationId,
292
292
  prompt: data.prompt,
293
293
  response: data.response,
294
294
  timestamp: data.timestamp
295
295
  });
296
296
 
297
297
  // Update user preferences based on interaction
298
- if (data.metadata.userPreferences) {
299
- await updateUserPreferences(data.metadata.userId, data.metadata.userPreferences);
298
+ if (data.params.userPreferences) {
299
+ await updateUserPreferences(data.params.userId, data.params.userPreferences);
300
300
  }
301
301
  });
302
302
  ```
@@ -1218,12 +1218,12 @@ class AgentRuntime {
1218
1218
  });
1219
1219
  }
1220
1220
 
1221
- // Build metadata object with all user-provided fields from request body (except prompt)
1222
- const metadata = {
1221
+ // Build params object with all user-provided fields from request body (except prompt)
1222
+ const params = {
1223
1223
  ...requestBodyFields,
1224
1224
  };
1225
1225
 
1226
- const response = await this.processDirectPrompt(prompt, metadata, {
1226
+ const response = await this.processDirectPrompt(prompt, params, {
1227
1227
  protocol: "http",
1228
1228
  clientIp: req.ip,
1229
1229
  });
@@ -1251,7 +1251,7 @@ class AgentRuntime {
1251
1251
  /**
1252
1252
  * Process a direct prompt and emit events
1253
1253
  */
1254
- async processDirectPrompt(prompt, metadata = {}, systemFields = {}) {
1254
+ async processDirectPrompt(prompt, params = {}, systemFields = {}) {
1255
1255
  const startTime = Date.now();
1256
1256
  let finalPrompt = prompt; // Declare outside try block so it's available in catch
1257
1257
 
@@ -1259,7 +1259,7 @@ class AgentRuntime {
1259
1259
  // Emit request start event and allow handlers to modify the prompt
1260
1260
  const startEventData = {
1261
1261
  prompt,
1262
- metadata,
1262
+ params,
1263
1263
  ...systemFields, // protocol, clientIp, etc.
1264
1264
  timestamp: new Date().toISOString(),
1265
1265
  };
@@ -1302,7 +1302,7 @@ class AgentRuntime {
1302
1302
  prompt,
1303
1303
  finalPrompt, // Include the final prompt that was sent to LLM
1304
1304
  response: response.content,
1305
- metadata,
1305
+ params,
1306
1306
  ...systemFields, // protocol, clientIp, etc.
1307
1307
  usage: response.usage,
1308
1308
  model: response.model,
@@ -1316,7 +1316,7 @@ class AgentRuntime {
1316
1316
  prompt,
1317
1317
  finalPrompt,
1318
1318
  response: response.content,
1319
- metadata,
1319
+ params,
1320
1320
  ...systemFields, // protocol, clientIp, etc.
1321
1321
  usage: response.usage,
1322
1322
  model: response.model,
@@ -1347,7 +1347,7 @@ class AgentRuntime {
1347
1347
  await this.emitEvent("request_output:error", {
1348
1348
  prompt,
1349
1349
  finalPrompt,
1350
- metadata,
1350
+ params,
1351
1351
  ...systemFields, // protocol, clientIp, etc.
1352
1352
  error: error.message,
1353
1353
  processingTime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dank-ai",
3
- "version": "1.0.45",
3
+ "version": "1.0.48",
4
4
  "description": "Dank Agent Service - Docker-based AI agent orchestration platform",
5
5
  "main": "lib/index.js",
6
6
  "exports": {