@openserv-labs/sdk 1.0.0 → 1.1.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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
6
6
 
7
- A comprehensive TypeScript library for building autonomous AI agents within the OpenServ platform. Featuring advanced cognitive capabilities like reasoning, decision-making, and inter-agent collaboration, along with powerful tools for task management, file operations, and human-in-the-loop interactions. Built with strong typing, extensible architecture, and an autonomous agent runtime.
7
+ A powerful TypeScript framework for building non-deterministic AI agents with advanced cognitive capabilities like reasoning, decision-making, and inter-agent collaboration within the OpenServ platform. Built with strong typing, extensible architecture, and a fully autonomous agent runtime.
8
8
 
9
9
  ## Table of Contents
10
10
 
@@ -12,6 +12,7 @@ A comprehensive TypeScript library for building autonomous AI agents within the
12
12
  - [Table of Contents](#table-of-contents)
13
13
  - [Features](#features)
14
14
  - [Framework Architecture](#framework-architecture)
15
+ - [Framework \& Blockchain Compatibility](#framework--blockchain-compatibility)
15
16
  - [Shadow Agents](#shadow-agents)
16
17
  - [Control Levels](#control-levels)
17
18
  - [Developer Focus](#developer-focus)
@@ -38,6 +39,8 @@ A comprehensive TypeScript library for building autonomous AI agents within the
38
39
  - [Workspace Management](#workspace-management)
39
40
  - [Get Files](#get-files)
40
41
  - [Upload File](#upload-file)
42
+ - [Integration Management](#integration-management)
43
+ - [Call Integration](#call-integration)
41
44
  - [Advanced Usage](#advanced-usage)
42
45
  - [OpenAI Process Runtime](#openai-process-runtime)
43
46
  - [Error Handling](#error-handling)
@@ -51,6 +54,8 @@ A comprehensive TypeScript library for building autonomous AI agents within the
51
54
  - 🤝 Inter-agent collaboration and communication
52
55
  - 🔌 Extensible agent architecture with custom capabilities
53
56
  - 🔧 Fully autonomous agent runtime with shadow agents
57
+ - 🌐 Framework-agnostic - integrate agents from any AI framework
58
+ - ⛓️ Blockchain-agnostic - compatible with any chain implementation
54
59
  - 🤖 Task execution and chat message handling
55
60
  - 🔄 Asynchronous task management
56
61
  - 📁 File operations and management
@@ -61,6 +66,22 @@ A comprehensive TypeScript library for building autonomous AI agents within the
61
66
 
62
67
  ## Framework Architecture
63
68
 
69
+ ### Framework & Blockchain Compatibility
70
+
71
+ OpenServ is designed to be completely framework and blockchain agnostic, allowing you to:
72
+
73
+ - Integrate agents built with any AI framework (e.g., LangChain, BabyAGI, Eliza, G.A.M.E, etc.)
74
+ - Connect agents operating on any blockchain network
75
+ - Mix and match different framework agents in the same workspace
76
+ - Maintain full compatibility with your existing agent implementations
77
+
78
+ This flexibility ensures you can:
79
+
80
+ - Use your preferred AI frameworks and tools
81
+ - Leverage existing agent implementations
82
+ - Integrate with any blockchain ecosystem
83
+ - Build cross-framework agent collaborations
84
+
64
85
  ### Shadow Agents
65
86
 
66
87
  Each agent is supported by two "shadow agents":
@@ -111,7 +132,7 @@ npm install @openserv-labs/sdk
111
132
 
112
133
  1. **Log In to the Platform**
113
134
 
114
- - Visit [OpenServ Platform](https://openserv.ai) and log in using your Google account
135
+ - Visit [OpenServ Platform](https://platform.openserv.ai) and log in using your Google account
115
136
  - This gives you access to developer tools and features
116
137
 
117
138
  2. **Set Up Developer Account**
@@ -152,12 +173,22 @@ npm install @openserv-labs/sdk
152
173
 
153
174
  ```typescript
154
175
  import { Agent } from '@openserv-labs/sdk'
176
+ import { z } from 'zod'
155
177
 
156
178
  const agent = new Agent({
157
- systemPrompt: 'You are a specialized agent that...',
158
- capabilities: [
159
- // Define your agent's capabilities
160
- ]
179
+ systemPrompt: 'You are a specialized agent that...'
180
+ })
181
+
182
+ // Add capabilities using the addCapability method
183
+ agent.addCapability({
184
+ name: 'greet',
185
+ description: 'Greet a user by name',
186
+ schema: z.object({
187
+ name: z.string().describe('The name of the user to greet')
188
+ }),
189
+ async run({ args }) {
190
+ return `Hello, ${args.name}! How can I help you today?`
191
+ }
161
192
  })
162
193
 
163
194
  // Start the agent server
@@ -488,6 +519,52 @@ await agent.uploadFile({
488
519
  })
489
520
  ```
490
521
 
522
+ ### Integration Management
523
+
524
+ #### Call Integration
525
+
526
+ ```typescript
527
+ const response = await agent.callIntegration({
528
+ workspaceId: number,
529
+ integrationId: string,
530
+ details: {
531
+ endpoint: string,
532
+ method: string,
533
+ data?: object
534
+ }
535
+ })
536
+ ```
537
+
538
+ Allows agents to interact with external services and APIs that are integrated with OpenServ. This method provides a secure way to make API calls to configured integrations within a workspace. Authentication is handled securely and automatically through the OpenServ platform. This is primarily useful for calling external APIs in a deterministic way.
539
+
540
+ **Parameters:**
541
+
542
+ - `workspaceId`: ID of the workspace where the integration is configured
543
+ - `integrationId`: ID of the integration to call (e.g., 'twitter-v2', 'github')
544
+ - `details`: Object containing:
545
+ - `endpoint`: The endpoint to call on the integration
546
+ - `method`: HTTP method (GET, POST, etc.)
547
+ - `data`: Optional payload for the request
548
+
549
+ **Returns:** The response from the integration endpoint
550
+
551
+ **Example:**
552
+
553
+ ```typescript
554
+ // Example: Sending a tweet using Twitter integration
555
+ const response = await agent.callIntegration({
556
+ workspaceId: 123,
557
+ integrationId: 'twitter-v2',
558
+ details: {
559
+ endpoint: '/2/tweets',
560
+ method: 'POST',
561
+ data: {
562
+ text: 'Hello from my AI agent!'
563
+ }
564
+ }
565
+ })
566
+ ```
567
+
491
568
  ## Advanced Usage
492
569
 
493
570
  ### OpenAI Process Runtime
package/dist/agent.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type AxiosInstance } from 'axios';
2
- import type { GetFilesParams, UploadFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams } from './types';
3
- import { actionSchema, doTaskActionSchema, respondChatMessageActionSchema } from './types';
2
+ import type { GetFilesParams, UploadFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, IntegrationCallRequest } from './types';
3
+ import type { doTaskActionSchema, respondChatMessageActionSchema } from './types';
4
+ import { actionSchema } from './types';
4
5
  import type { ChatCompletionMessageParam, ChatCompletion } from 'openai/resources/chat/completions';
5
6
  import OpenAI from 'openai';
6
7
  import type { z } from 'zod';
@@ -30,6 +31,13 @@ export interface AgentOptions {
30
31
  * Required when using the process() method.
31
32
  */
32
33
  openaiApiKey?: string;
34
+ /**
35
+ * Error handler function for all agent operations.
36
+ * Defaults to logging the error if not provided.
37
+ * @param error - The error that occurred
38
+ * @param context - Additional context about where the error occurred
39
+ */
40
+ onError?: (error: Error, context?: Record<string, unknown>) => void;
33
41
  }
34
42
  export declare class Agent {
35
43
  private options;
@@ -68,7 +76,7 @@ export declare class Agent {
68
76
  * Each capability is an instance of the Capability class with a name, description, schema, and run function.
69
77
  * @protected
70
78
  */
71
- protected tools: Array<Capability<any>>;
79
+ protected tools: Array<Capability<z.ZodTypeAny>>;
72
80
  /**
73
81
  * The OpenServ API key used for authentication.
74
82
  * Can be provided in options or via OPENSERV_API_KEY environment variable.
@@ -138,7 +146,7 @@ export declare class Agent {
138
146
  name: string;
139
147
  description: string;
140
148
  schema: S;
141
- run(params: {
149
+ run(this: Agent, params: {
142
150
  args: z.infer<S>;
143
151
  action?: z.infer<typeof actionSchema>;
144
152
  }, messages: ChatCompletionMessageParam[]): string | Promise<string>;
@@ -161,10 +169,10 @@ export declare class Agent {
161
169
  name: string;
162
170
  description: string;
163
171
  schema: T[K];
164
- run: (params: {
172
+ run(this: Agent, params: {
165
173
  args: z.infer<T[K]>;
166
174
  action?: z.infer<typeof actionSchema>;
167
- }, messages: ChatCompletionMessageParam[]) => string | Promise<string>;
175
+ }, messages: ChatCompletionMessageParam[]): string | Promise<string>;
168
176
  };
169
177
  }): this;
170
178
  /**
@@ -320,6 +328,7 @@ export declare class Agent {
320
328
  * @param {Object} req.body - Request body
321
329
  * @param {z.infer<z.ZodTypeAny>} [req.body.args] - Arguments for the tool
322
330
  * @param {z.infer<typeof actionSchema>} [req.body.action] - Action context
331
+ * @param {ChatCompletionMessageParam[]} [req.body.messages] - Message history
323
332
  * @returns {Promise<{result: string}>} The result of the tool execution
324
333
  * @throws {BadRequest} If tool name is missing or tool is not found
325
334
  * @throws {Error} If tool execution fails
@@ -331,6 +340,7 @@ export declare class Agent {
331
340
  body: {
332
341
  args?: z.infer<z.ZodTypeAny>;
333
342
  action?: z.infer<typeof actionSchema>;
343
+ messages?: ChatCompletionMessageParam[];
334
344
  };
335
345
  }): Promise<{
336
346
  result: string;
@@ -365,5 +375,25 @@ export declare class Agent {
365
375
  * @returns {Promise<void>} Resolves when the server has stopped
366
376
  */
367
377
  stop(): Promise<void>;
378
+ /**
379
+ * Default error handler that logs the error
380
+ * @private
381
+ */
382
+ private handleError;
383
+ /**
384
+ * Calls an integration endpoint through the OpenServ platform.
385
+ * This method allows agents to interact with external services and APIs that are integrated with OpenServ.
386
+ *
387
+ * @param {IntegrationCallRequest} integration - The integration request parameters
388
+ * @param {number} integration.workspaceId - ID of the workspace where the integration is configured
389
+ * @param {string} integration.integrationId - ID of the integration to call
390
+ * @param {Object} integration.details - Details of the integration call
391
+ * @param {string} integration.details.endpoint - The endpoint to call on the integration
392
+ * @param {string} integration.details.method - The HTTP method to use (GET, POST, etc.)
393
+ * @param {Object} [integration.details.data] - Optional data payload for the request
394
+ * @returns {Promise<any>} The response from the integration endpoint
395
+ * @throws {Error} If the integration call fails
396
+ */
397
+ callIntegration(integration: IntegrationCallRequest): Promise<any>;
368
398
  }
369
399
  //# sourceMappingURL=agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"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IAOnB;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,WAAW,EAAE,sBAAsB;CAQ1D"}
package/dist/agent.js CHANGED
@@ -177,6 +177,7 @@ class Agent {
177
177
  if (this.tools.some(tool => tool.name === name)) {
178
178
  throw new Error(`Tool with name "${name}" already exists`);
179
179
  }
180
+ // Type assertion through unknown for safe conversion between compatible generic types
180
181
  this.tools.push(new capability_1.Capability(name, description, schema, run));
181
182
  return this;
182
183
  }
@@ -194,9 +195,9 @@ class Agent {
194
195
  * @throws {Error} If any capability has a name that already exists
195
196
  */
196
197
  addCapabilities(capabilities) {
197
- capabilities.forEach(capability => {
198
+ for (const capability of capabilities) {
198
199
  this.addCapability(capability);
199
- });
200
+ }
200
201
  return this;
201
202
  }
202
203
  /**
@@ -407,55 +408,75 @@ class Agent {
407
408
  * @throws {Error} If no response is received from OpenAI or max iterations are reached
408
409
  */
409
410
  async process({ messages }) {
410
- const currentMessages = [...messages];
411
- let completion = null;
412
- let iterationCount = 0;
413
- const MAX_ITERATIONS = 10;
414
- while (iterationCount < MAX_ITERATIONS) {
415
- completion = await this.openai.chat.completions.create({
416
- model: 'gpt-4o',
417
- messages: currentMessages,
418
- tools: this.openAiTools
419
- });
420
- if (!completion.choices?.length || !completion.choices[0]?.message) {
421
- throw new Error('No response from OpenAI');
422
- }
423
- const lastMessage = completion.choices[0].message;
424
- // If there are no tool calls, we're done
425
- if (!lastMessage.tool_calls?.length) {
426
- return completion;
411
+ try {
412
+ const apiKey = this.options.openaiApiKey || process.env.OPENAI_API_KEY;
413
+ if (!apiKey) {
414
+ throw new Error('OpenAI API key is required for process(). Please provide it in options or set OPENAI_API_KEY environment variable.');
427
415
  }
428
- // Process each tool call
429
- const toolResults = await Promise.all(lastMessage.tool_calls.map(async (toolCall) => {
430
- // We know the function exists because we provided the tools
431
- const { name, arguments: args } = toolCall.function;
432
- const parsedArgs = JSON.parse(args);
433
- try {
434
- // Call the corresponding method on this class with named parameters
435
- const result = await this[name](parsedArgs);
436
- return {
437
- tool_call_id: toolCall.id,
438
- role: 'tool',
439
- name,
440
- content: JSON.stringify(result)
441
- };
416
+ const currentMessages = [...messages];
417
+ let completion = null;
418
+ let iterationCount = 0;
419
+ const MAX_ITERATIONS = 10;
420
+ while (iterationCount < MAX_ITERATIONS) {
421
+ completion = await this.openai.chat.completions.create({
422
+ model: 'gpt-4o',
423
+ messages: currentMessages,
424
+ tools: this.tools.length ? this.openAiTools : undefined
425
+ });
426
+ if (!completion.choices?.length || !completion.choices[0]?.message) {
427
+ throw new Error('No response from OpenAI');
442
428
  }
443
- catch (error) {
444
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
445
- logger_1.logger.error({ error, toolCall }, 'Error executing tool call');
446
- return {
447
- tool_call_id: toolCall.id,
448
- role: 'tool',
449
- name,
450
- content: JSON.stringify({ error: errorMessage })
451
- };
429
+ const lastMessage = completion.choices[0].message;
430
+ // If there are no tool calls, we're done
431
+ if (!lastMessage.tool_calls?.length) {
432
+ return completion;
452
433
  }
453
- }));
454
- // Add the assistant's message and tool results to the conversation
455
- currentMessages.push(lastMessage, ...toolResults);
456
- iterationCount++;
434
+ // Process each tool call
435
+ const toolResults = await Promise.all(lastMessage.tool_calls.map(async (toolCall) => {
436
+ if (!toolCall.function) {
437
+ throw new Error('Tool call function is missing');
438
+ }
439
+ const { name, arguments: args } = toolCall.function;
440
+ const parsedArgs = JSON.parse(args);
441
+ try {
442
+ // Find the tool in our tools array
443
+ const tool = this.tools.find(t => t.name === name);
444
+ if (!tool) {
445
+ throw new Error(`Tool "${name}" not found`);
446
+ }
447
+ // Call the tool's run method with the parsed arguments and bind this
448
+ const result = await tool.run.bind(this)({ args: parsedArgs }, currentMessages);
449
+ return {
450
+ role: 'tool',
451
+ content: JSON.stringify(result),
452
+ tool_call_id: toolCall.id
453
+ };
454
+ }
455
+ catch (error) {
456
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
457
+ this.handleError(error instanceof Error ? error : new Error(errorMessage), {
458
+ toolCall,
459
+ context: 'tool_execution'
460
+ });
461
+ return {
462
+ role: 'tool',
463
+ content: JSON.stringify({ error: errorMessage }),
464
+ tool_call_id: toolCall.id
465
+ };
466
+ }
467
+ }));
468
+ // Add the assistant's message and tool results to the conversation
469
+ currentMessages.push(lastMessage, ...toolResults);
470
+ iterationCount++;
471
+ }
472
+ throw new Error('Max iterations reached without completion');
473
+ }
474
+ catch (error) {
475
+ this.handleError(error instanceof Error ? error : new Error(String(error)), {
476
+ context: 'process'
477
+ });
478
+ throw error;
457
479
  }
458
- throw new Error('Max iterations reached without completion');
459
480
  }
460
481
  /**
461
482
  * Handle a task execution request
@@ -483,15 +504,10 @@ class Agent {
483
504
  });
484
505
  }
485
506
  catch (error) {
486
- if (action.task) {
487
- await this.markTaskAsErrored({
488
- workspaceId: action.workspace.id,
489
- taskId: action.task.id,
490
- error: error instanceof Error ? error.message : 'Unknown error occurred'
491
- });
492
- }
493
- logger_1.logger.error({ error }, 'Failed to forward action to runtime agent');
494
- throw error;
507
+ this.handleError(error instanceof Error ? error : new Error(String(error)), {
508
+ action,
509
+ context: 'do_task'
510
+ });
495
511
  }
496
512
  }
497
513
  /**
@@ -507,12 +523,12 @@ class Agent {
507
523
  }
508
524
  ];
509
525
  if (action.messages) {
510
- action.messages.forEach((msg) => {
526
+ for (const msg of action.messages) {
511
527
  messages.push({
512
528
  role: msg.author === 'user' ? 'user' : 'assistant',
513
529
  content: msg.message
514
530
  });
515
- });
531
+ }
516
532
  }
517
533
  try {
518
534
  await this.runtimeClient.post('/chat', {
@@ -522,13 +538,10 @@ class Agent {
522
538
  });
523
539
  }
524
540
  catch (error) {
525
- await this.sendChatMessage({
526
- workspaceId: action.workspace.id,
527
- agentId: action.me.id,
528
- message: error instanceof Error ? error.message : 'Unknown error occurred'
541
+ this.handleError(error instanceof Error ? error : new Error(String(error)), {
542
+ action,
543
+ context: 'respond_to_chat'
529
544
  });
530
- logger_1.logger.error({ error }, 'Failed to forward action to runtime agent');
531
- throw error;
532
545
  }
533
546
  }
534
547
  /**
@@ -540,26 +553,31 @@ class Agent {
540
553
  * @param {Object} req.body - Request body
541
554
  * @param {z.infer<z.ZodTypeAny>} [req.body.args] - Arguments for the tool
542
555
  * @param {z.infer<typeof actionSchema>} [req.body.action] - Action context
556
+ * @param {ChatCompletionMessageParam[]} [req.body.messages] - Message history
543
557
  * @returns {Promise<{result: string}>} The result of the tool execution
544
558
  * @throws {BadRequest} If tool name is missing or tool is not found
545
559
  * @throws {Error} If tool execution fails
546
560
  */
547
561
  async handleToolRoute(req) {
548
- if (!('toolName' in req.params)) {
549
- throw new http_errors_1.BadRequest('Tool name is required');
550
- }
551
- const tool = this.tools.find(t => t.name === req.params.toolName);
552
- if (!tool) {
553
- throw new http_errors_1.BadRequest(`Tool "${req.params.toolName}" not found`);
554
- }
555
562
  try {
563
+ if (!('toolName' in req.params)) {
564
+ throw new http_errors_1.BadRequest('Tool name is required');
565
+ }
566
+ const tool = this.tools.find(t => t.name === req.params.toolName);
567
+ if (!tool) {
568
+ throw new http_errors_1.BadRequest(`Tool "${req.params.toolName}" not found`);
569
+ }
556
570
  const args = await tool.schema.parseAsync(req.body?.args);
557
- const result = await tool.run.call(this, { args, action: req.body.action }, []);
571
+ const messages = req.body.messages || [];
572
+ const result = await tool.run.call(this, { args, action: req.body.action }, messages);
558
573
  return { result };
559
574
  }
560
575
  catch (error) {
561
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
562
- throw new Error(errorMessage);
576
+ this.handleError(error instanceof Error ? error : new Error(String(error)), {
577
+ request: req,
578
+ context: 'handle_tool_route'
579
+ });
580
+ throw error;
563
581
  }
564
582
  }
565
583
  /**
@@ -571,15 +589,23 @@ class Agent {
571
589
  * @throws {Error} If action type is invalid
572
590
  */
573
591
  async handleRootRoute(req) {
574
- const action = await types_1.actionSchema.parseAsync(req.body);
575
- if (action.type === 'do-task') {
576
- this.doTask(action);
592
+ try {
593
+ const action = await types_1.actionSchema.parseAsync(req.body);
594
+ if (action.type === 'do-task') {
595
+ this.doTask(action);
596
+ }
597
+ else if (action.type === 'respond-chat-message') {
598
+ this.respondToChat(action);
599
+ }
600
+ else
601
+ throw new Error('Invalid action type');
577
602
  }
578
- else if (action.type === 'respond-chat-message') {
579
- this.respondToChat(action);
603
+ catch (error) {
604
+ this.handleError(error instanceof Error ? error : new Error(String(error)), {
605
+ request: req,
606
+ context: 'handle_root_route'
607
+ });
580
608
  }
581
- else
582
- throw new Error('Invalid action type');
583
609
  }
584
610
  /**
585
611
  * Sets up the Express routes for the agent's HTTP server.
@@ -632,6 +658,33 @@ class Agent {
632
658
  this.server?.close(() => resolve());
633
659
  });
634
660
  }
661
+ /**
662
+ * Default error handler that logs the error
663
+ * @private
664
+ */
665
+ handleError(error, context) {
666
+ const handler = this.options.onError ??
667
+ ((err, ctx) => logger_1.logger.error({ error: err, ...ctx }, 'Error in agent operation'));
668
+ handler(error, context);
669
+ }
670
+ /**
671
+ * Calls an integration endpoint through the OpenServ platform.
672
+ * This method allows agents to interact with external services and APIs that are integrated with OpenServ.
673
+ *
674
+ * @param {IntegrationCallRequest} integration - The integration request parameters
675
+ * @param {number} integration.workspaceId - ID of the workspace where the integration is configured
676
+ * @param {string} integration.integrationId - ID of the integration to call
677
+ * @param {Object} integration.details - Details of the integration call
678
+ * @param {string} integration.details.endpoint - The endpoint to call on the integration
679
+ * @param {string} integration.details.method - The HTTP method to use (GET, POST, etc.)
680
+ * @param {Object} [integration.details.data] - Optional data payload for the request
681
+ * @returns {Promise<any>} The response from the integration endpoint
682
+ * @throws {Error} If the integration call fails
683
+ */
684
+ async callIntegration(integration) {
685
+ const response = await this.apiClient.post(`/workspaces/${integration.workspaceId}/integration/${integration.integrationId}/proxy`, integration.details);
686
+ return response.data;
687
+ }
635
688
  }
636
689
  exports.Agent = Agent;
637
690
  function convertToolToJsonSchema(tool) {
@@ -1,11 +1,12 @@
1
- import { z } from 'zod';
1
+ import type { z } from 'zod';
2
2
  import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions';
3
3
  import type { CapabilityFuncParams } from './types';
4
+ import type { Agent } from './agent';
4
5
  export declare class Capability<Schema extends z.ZodTypeAny> {
5
6
  readonly name: string;
6
7
  readonly description: string;
7
8
  readonly schema: Schema;
8
- readonly run: (params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>;
9
- constructor(name: string, description: string, schema: Schema, run: (params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>);
9
+ readonly run: (this: Agent, params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>;
10
+ constructor(name: string, description: string, schema: Schema, run: (this: Agent, params: CapabilityFuncParams<Schema>, messages: ChatCompletionMessageParam[]) => string | Promise<string>);
10
11
  }
11
12
  //# sourceMappingURL=capability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,qBAAa,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC,UAAU;aAE/B,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,MAAM;aACnB,MAAM,EAAE,MAAM;aACd,GAAG,EAAE,CACnB,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,0BAA0B,EAAE,KACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;gBANb,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,CACnB,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,0BAA0B,EAAE,KACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAEhC"}
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC,UAAU;aAE/B,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,MAAM;aACnB,MAAM,EAAE,MAAM;aACd,GAAG,EAAE,CACnB,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,0BAA0B,EAAE,KACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;gBAPb,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,CACnB,IAAI,EAAE,KAAK,EACX,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACpC,QAAQ,EAAE,0BAA0B,EAAE,KACnC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAEhC"}
package/dist/types.d.ts CHANGED
@@ -1305,4 +1305,23 @@ export interface UpdateTaskStatusParams {
1305
1305
  export interface ProcessParams {
1306
1306
  messages: ChatCompletionMessageParam[];
1307
1307
  }
1308
+ export interface ProxyConfiguration {
1309
+ endpoint: string;
1310
+ providerConfigKey?: string;
1311
+ connectionId?: string;
1312
+ method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'get' | 'post' | 'patch' | 'put' | 'delete';
1313
+ headers?: Record<string, string>;
1314
+ params?: string | Record<string, string | number>;
1315
+ data?: unknown;
1316
+ retries?: number;
1317
+ baseUrlOverride?: string;
1318
+ decompress?: boolean;
1319
+ responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
1320
+ retryOn?: number[] | null;
1321
+ }
1322
+ export interface IntegrationCallRequest {
1323
+ workspaceId: number;
1324
+ integrationId: string;
1325
+ details: ProxyConfiguration;
1326
+ }
1308
1327
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAA;AAKnF,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,CAAC,CAAC,UAAU,IAAI;IAC9D,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACrB,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,SAAS,8CAA4C,CAAA;AAElE,eAAO,MAAM,gBAAgB,gGAEC,CAAA;AAE9B,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Ae,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;IAC/E,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,kBAAkB,CAAA;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openserv-labs/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "OpenServ Agent SDK - Create AI agents easily",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,6 +8,7 @@
8
8
  "build": "tsc",
9
9
  "dev": "tsc --watch",
10
10
  "dev:example": "ts-node-dev --respawn --transpile-only examples/marketing-agent.ts",
11
+ "dev:twitter": "ts-node-dev --respawn --transpile-only examples/twitter-agent.ts",
11
12
  "dev:custom-agent": "ts-node-dev --respawn --transpile-only examples/custom-agent.ts",
12
13
  "check-types": "tsc --noEmit",
13
14
  "prepublishOnly": "npm run build && npm run lint && npm run check-types && npm run test",