@openserv-labs/sdk 1.1.0 → 1.3.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
@@ -1,4 +1,4 @@
1
- # OpenServ Autonomous AI Agent Development Framework
1
+ # OpenServ TypeScript SDK, Autonomous AI Agent Development Framework
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@openserv-labs%2Fsdk.svg)](https://www.npmjs.com/package/@openserv-labs/sdk)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -411,6 +411,12 @@ await agent.sendChatMessage({
411
411
  agentId: 456,
412
412
  message: 'How can I assist you today?'
413
413
  })
414
+
415
+ // Get agent chat
416
+ await agent.getChatMessages({
417
+ workspaceId: 123,
418
+ agentId: 456
419
+ })
414
420
  ```
415
421
 
416
422
  ### File Operations
package/dist/agent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type AxiosInstance } from 'axios';
2
- import type { GetFilesParams, UploadFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, IntegrationCallRequest } from './types';
2
+ import type { GetFilesParams, GetSecretsParams, GetSecretValueParams, UploadFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, IntegrationCallRequest, GetChatMessagesParams } from './types';
3
3
  import type { doTaskActionSchema, respondChatMessageActionSchema } from './types';
4
4
  import { actionSchema } from './types';
5
5
  import type { ChatCompletionMessageParam, ChatCompletion } from 'openai/resources/chat/completions';
@@ -183,6 +183,20 @@ export declare class Agent {
183
183
  * @returns {Promise<any>} The files in the workspace
184
184
  */
185
185
  getFiles(params: GetFilesParams): Promise<any>;
186
+ /**
187
+ * Get all secrets for an agent in a workspace.
188
+ *
189
+ * @param {GetSecretsParams} params - Parameters for the secrets retrieval
190
+ * @returns {Promise<any>} List of agent secrets.
191
+ */
192
+ getSecrets(params: GetSecretsParams): Promise<any>;
193
+ /**
194
+ * Get the value of a secret for an agent in a workspace
195
+ *
196
+ * @param {GetSecretValueParams} params - Parameters for the secret value retrieval
197
+ * @returns {Promise<string>} The value of the secret.
198
+ */
199
+ getSecretValue(params: GetSecretValueParams): Promise<string>;
186
200
  /**
187
201
  * Uploads a file to a workspace.
188
202
  *
@@ -250,6 +264,26 @@ export declare class Agent {
250
264
  * @returns {Promise<any>} List of tasks in the workspace
251
265
  */
252
266
  getTasks(params: GetTasksParams): Promise<any>;
267
+ /**
268
+ * Gets a list of tasks in a workspace.
269
+ *
270
+ * @param {GetChatMessagesParams} params - Parameters for getting chat messages
271
+ * @param {number} params.workspaceId - ID of the workspace to get chat messages from
272
+ * @param {number} params.agentId - ID of the agent to get chat messages from
273
+ * @returns {Promise<AgentChatMessagesResponse>} List of chat messages
274
+ */
275
+ getChatMessages(params: GetChatMessagesParams): Promise<{
276
+ messages: {
277
+ message: string;
278
+ id: number;
279
+ createdAt: Date;
280
+ author: "agent" | "user";
281
+ }[];
282
+ agent: {
283
+ name: string;
284
+ id: number;
285
+ };
286
+ }>;
253
287
  /**
254
288
  * Creates a new task in a workspace.
255
289
  *
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAA;AASjD,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,sBAA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,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;YAC5B,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAA;YACrC,QAAQ,CAAC,EAAE,0BAA0B,EAAE,CAAA;SACxC,CAAA;KACF;;;IAyBD;;;;;;;OAOG;IACG,eAAe,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE;IAgB5C;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAuBnB;;;;;OAKG;IACG,KAAK;IAUX;;;;OAIG;IACG,IAAI;IAQV;;;OAGG;IACH,OAAO,CAAC,WAAW;IAOnB;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,WAAW,EAAE,sBAAsB;CAQ1D"}
package/dist/agent.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Agent = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
+ const bcryptjs_1 = __importDefault(require("bcryptjs"));
8
9
  const compression_1 = __importDefault(require("compression"));
9
10
  const express_1 = __importDefault(require("express"));
10
11
  const express_async_router_1 = require("express-async-router");
@@ -19,6 +20,20 @@ const capability_1 = require("./capability");
19
20
  const PLATFORM_URL = process.env.OPENSERV_API_URL || 'https://api.openserv.ai';
20
21
  const RUNTIME_URL = process.env.OPENSERV_RUNTIME_URL || 'https://agents.openserv.ai';
21
22
  const DEFAULT_PORT = Number.parseInt(process.env.PORT || '') || 7378;
23
+ const AUTH_TOKEN = process.env.OPENSERV_AUTH_TOKEN;
24
+ const authTokenMiddleware = async (req, res, next) => {
25
+ const tokenHash = req.headers['x-openserv-auth-token'];
26
+ if (!tokenHash || typeof tokenHash !== 'string') {
27
+ res.status(401).json({ error: 'Unauthorized' });
28
+ return;
29
+ }
30
+ const isTokenValid = await bcryptjs_1.default.compare(AUTH_TOKEN, tokenHash);
31
+ if (!isTokenValid) {
32
+ res.status(401).json({ error: 'Unauthorized' });
33
+ return;
34
+ }
35
+ next();
36
+ };
22
37
  class Agent {
23
38
  options;
24
39
  /**
@@ -153,6 +168,12 @@ class Agent {
153
168
  this.app.use((0, hpp_1.default)());
154
169
  this.app.use((0, helmet_1.default)());
155
170
  this.app.use((0, compression_1.default)());
171
+ if (AUTH_TOKEN) {
172
+ this.app.use(authTokenMiddleware);
173
+ }
174
+ else {
175
+ logger_1.logger.warn('OPENSERV_AUTH_TOKEN is not set. All requests will be allowed.');
176
+ }
156
177
  this.setupRoutes();
157
178
  }
158
179
  /**
@@ -211,6 +232,26 @@ class Agent {
211
232
  const response = await this.apiClient.get(`/workspaces/${params.workspaceId}/files`);
212
233
  return response.data;
213
234
  }
235
+ /**
236
+ * Get all secrets for an agent in a workspace.
237
+ *
238
+ * @param {GetSecretsParams} params - Parameters for the secrets retrieval
239
+ * @returns {Promise<any>} List of agent secrets.
240
+ */
241
+ async getSecrets(params) {
242
+ const response = await this.apiClient.get(`/workspaces/${params.workspaceId}/agent-secrets`);
243
+ return response.data;
244
+ }
245
+ /**
246
+ * Get the value of a secret for an agent in a workspace
247
+ *
248
+ * @param {GetSecretValueParams} params - Parameters for the secret value retrieval
249
+ * @returns {Promise<string>} The value of the secret.
250
+ */
251
+ async getSecretValue(params) {
252
+ const response = await this.apiClient.get(`/workspaces/${params.workspaceId}/agent-secrets/${params.secretId}/value`);
253
+ return response.data;
254
+ }
214
255
  /**
215
256
  * Uploads a file to a workspace.
216
257
  *
@@ -322,6 +363,18 @@ class Agent {
322
363
  const response = await this.apiClient.get(`/workspaces/${params.workspaceId}/tasks`);
323
364
  return response.data;
324
365
  }
366
+ /**
367
+ * Gets a list of tasks in a workspace.
368
+ *
369
+ * @param {GetChatMessagesParams} params - Parameters for getting chat messages
370
+ * @param {number} params.workspaceId - ID of the workspace to get chat messages from
371
+ * @param {number} params.agentId - ID of the agent to get chat messages from
372
+ * @returns {Promise<AgentChatMessagesResponse>} List of chat messages
373
+ */
374
+ async getChatMessages(params) {
375
+ const response = await this.apiClient.get(`/workspaces/${params.workspaceId}/agent-chat/${params.agentId}/messages`);
376
+ return response.data;
377
+ }
325
378
  /**
326
379
  * Creates a new task in a workspace.
327
380
  *
@@ -377,9 +430,22 @@ class Agent {
377
430
  * @returns {Promise<any>} The created assistance request details
378
431
  */
379
432
  async requestHumanAssistance(params) {
433
+ let question = params.question;
434
+ if (typeof question === 'string') {
435
+ question = {
436
+ type: 'text',
437
+ question
438
+ };
439
+ }
440
+ else {
441
+ question = {
442
+ type: 'json',
443
+ ...question
444
+ };
445
+ }
380
446
  const response = await this.apiClient.post(`/workspaces/${params.workspaceId}/tasks/${params.taskId}/human-assistance`, {
381
447
  type: params.type,
382
- question: params.question,
448
+ question,
383
449
  agentDump: params.agentDump
384
450
  });
385
451
  return response.data;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { Agent } from './agent';
2
2
  export type { AgentOptions } from './agent';
3
3
  export { Capability } from './capability';
4
- export type { TaskStatus, GetFilesParams, UploadFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, CapabilityFuncParams } from './types';
4
+ export type { TaskStatus, GetFilesParams, UploadFileParams, MarkTaskAsErroredParams, CompleteTaskParams, SendChatMessageParams, GetTaskDetailParams, GetAgentsParams, GetTasksParams, CreateTaskParams, AddLogToTaskParams, RequestHumanAssistanceParams, UpdateTaskStatusParams, ProcessParams, CapabilityFuncParams, GetChatMessagesParams } from './types';
5
5
  export { actionSchema, doTaskActionSchema, respondChatMessageActionSchema, taskStatusSchema, agentKind } from './types';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,EAC9B,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,EAC9B,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,6CAIrB,CAAA;AAEJ,eAAO,MAAM,MAAM,uCAAiB,CAAA"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,6CAUrB,CAAA;AAEJ,eAAO,MAAM,MAAM,uCAAiB,CAAA"}
package/dist/logger.js CHANGED
@@ -7,7 +7,13 @@ exports.logger = exports.createLogger = void 0;
7
7
  const pino_1 = __importDefault(require("pino"));
8
8
  const createLogger = () => (0, pino_1.default)({
9
9
  name: 'openserv-agent',
10
- level: process.env.LOG_LEVEL || 'info'
10
+ level: process.env.LOG_LEVEL || 'info',
11
+ transport: {
12
+ target: 'pino-pretty',
13
+ options: {
14
+ colorize: true
15
+ }
16
+ }
11
17
  });
12
18
  exports.createLogger = createLogger;
13
19
  exports.logger = (0, exports.createLogger)();
package/dist/types.d.ts CHANGED
@@ -87,28 +87,155 @@ export declare const doTaskActionSchema: z.ZodObject<{
87
87
  }[];
88
88
  output?: string | null | undefined;
89
89
  }>, "many">;
90
- humanAssistanceRequests: z.ZodArray<z.ZodObject<{
90
+ humanAssistanceRequests: z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
91
+ type: z.ZodLiteral<"text">;
92
+ question: z.ZodObject<{
93
+ type: z.ZodLiteral<"text">;
94
+ question: z.ZodString;
95
+ }, "strip", z.ZodTypeAny, {
96
+ type: "text";
97
+ question: string;
98
+ }, {
99
+ type: "text";
100
+ question: string;
101
+ }>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ type: "text";
104
+ question: {
105
+ type: "text";
106
+ question: string;
107
+ };
108
+ }, {
109
+ type: "text";
110
+ question: {
111
+ type: "text";
112
+ question: string;
113
+ };
114
+ }>, z.ZodObject<{
115
+ type: z.ZodLiteral<"project-manager-plan-review">;
116
+ question: z.ZodObject<z.objectUtil.extendShape<{
117
+ tasks: z.ZodArray<z.ZodObject<{
118
+ index: z.ZodNumber;
119
+ assigneeAgentId: z.ZodNumber;
120
+ assigneeAgentName: z.ZodString;
121
+ taskDescription: z.ZodString;
122
+ taskBody: z.ZodString;
123
+ input: z.ZodString;
124
+ expectedOutput: z.ZodString;
125
+ }, "strip", z.ZodTypeAny, {
126
+ expectedOutput: string;
127
+ input: string;
128
+ index: number;
129
+ assigneeAgentId: number;
130
+ assigneeAgentName: string;
131
+ taskDescription: string;
132
+ taskBody: string;
133
+ }, {
134
+ expectedOutput: string;
135
+ input: string;
136
+ index: number;
137
+ assigneeAgentId: number;
138
+ assigneeAgentName: string;
139
+ taskDescription: string;
140
+ taskBody: string;
141
+ }>, "many">;
142
+ }, {
143
+ type: z.ZodLiteral<"project-manager-plan-review">;
144
+ }>, "strip", z.ZodTypeAny, {
145
+ type: "project-manager-plan-review";
146
+ tasks: {
147
+ expectedOutput: string;
148
+ input: string;
149
+ index: number;
150
+ assigneeAgentId: number;
151
+ assigneeAgentName: string;
152
+ taskDescription: string;
153
+ taskBody: string;
154
+ }[];
155
+ }, {
156
+ type: "project-manager-plan-review";
157
+ tasks: {
158
+ expectedOutput: string;
159
+ input: string;
160
+ index: number;
161
+ assigneeAgentId: number;
162
+ assigneeAgentName: string;
163
+ taskDescription: string;
164
+ taskBody: string;
165
+ }[];
166
+ }>;
167
+ }, "strip", z.ZodTypeAny, {
168
+ type: "project-manager-plan-review";
169
+ question: {
170
+ type: "project-manager-plan-review";
171
+ tasks: {
172
+ expectedOutput: string;
173
+ input: string;
174
+ index: number;
175
+ assigneeAgentId: number;
176
+ assigneeAgentName: string;
177
+ taskDescription: string;
178
+ taskBody: string;
179
+ }[];
180
+ };
181
+ }, {
182
+ type: "project-manager-plan-review";
183
+ question: {
184
+ type: "project-manager-plan-review";
185
+ tasks: {
186
+ expectedOutput: string;
187
+ input: string;
188
+ index: number;
189
+ assigneeAgentId: number;
190
+ assigneeAgentName: string;
191
+ taskDescription: string;
192
+ taskBody: string;
193
+ }[];
194
+ };
195
+ }>, z.ZodObject<{
196
+ type: z.ZodLiteral<"insufficient-balance">;
197
+ question: z.ZodObject<{
198
+ type: z.ZodLiteral<"insufficient-balance">;
199
+ }, "strip", z.ZodTypeAny, {
200
+ type: "insufficient-balance";
201
+ }, {
202
+ type: "insufficient-balance";
203
+ }>;
204
+ }, "strip", z.ZodTypeAny, {
205
+ type: "insufficient-balance";
206
+ question: {
207
+ type: "insufficient-balance";
208
+ };
209
+ }, {
210
+ type: "insufficient-balance";
211
+ question: {
212
+ type: "insufficient-balance";
213
+ };
214
+ }>, z.ZodObject<{
215
+ type: z.ZodLiteral<"json">;
216
+ question: z.ZodAny;
217
+ }, "strip", z.ZodTypeAny, {
218
+ type: "json";
219
+ question?: any;
220
+ }, {
221
+ type: "json";
222
+ question?: any;
223
+ }>]>, z.ZodObject<{
91
224
  agentDump: z.ZodUnknown;
92
225
  humanResponse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
93
226
  id: z.ZodNumber;
94
- question: z.ZodString;
95
227
  status: z.ZodEnum<["pending", "responded"]>;
96
- type: z.ZodEnum<["text", "project-manager-plan-review"]>;
97
228
  }, "strip", z.ZodTypeAny, {
98
- type: "text" | "project-manager-plan-review";
99
229
  status: "pending" | "responded";
100
230
  id: number;
101
- question: string;
102
231
  agentDump?: unknown;
103
232
  humanResponse?: string | null | undefined;
104
233
  }, {
105
- type: "text" | "project-manager-plan-review";
106
234
  status: "pending" | "responded";
107
235
  id: number;
108
- question: string;
109
236
  agentDump?: unknown;
110
237
  humanResponse?: string | null | undefined;
111
- }>, "many">;
238
+ }>>, "many">;
112
239
  }, "strip", z.ZodTypeAny, {
113
240
  description: string;
114
241
  id: number;
@@ -124,14 +251,40 @@ export declare const doTaskActionSchema: z.ZodObject<{
124
251
  }[];
125
252
  output?: string | null | undefined;
126
253
  }[];
127
- humanAssistanceRequests: {
128
- type: "text" | "project-manager-plan-review";
254
+ humanAssistanceRequests: (({
255
+ type: "text";
256
+ question: {
257
+ type: "text";
258
+ question: string;
259
+ };
260
+ } | {
261
+ type: "project-manager-plan-review";
262
+ question: {
263
+ type: "project-manager-plan-review";
264
+ tasks: {
265
+ expectedOutput: string;
266
+ input: string;
267
+ index: number;
268
+ assigneeAgentId: number;
269
+ assigneeAgentName: string;
270
+ taskDescription: string;
271
+ taskBody: string;
272
+ }[];
273
+ };
274
+ } | {
275
+ type: "insufficient-balance";
276
+ question: {
277
+ type: "insufficient-balance";
278
+ };
279
+ } | {
280
+ type: "json";
281
+ question?: any;
282
+ }) & {
129
283
  status: "pending" | "responded";
130
284
  id: number;
131
- question: string;
132
285
  agentDump?: unknown;
133
286
  humanResponse?: string | null | undefined;
134
- }[];
287
+ })[];
135
288
  body?: string | null | undefined;
136
289
  expectedOutput?: string | null | undefined;
137
290
  input?: string | null | undefined;
@@ -150,14 +303,40 @@ export declare const doTaskActionSchema: z.ZodObject<{
150
303
  }[];
151
304
  output?: string | null | undefined;
152
305
  }[];
153
- humanAssistanceRequests: {
154
- type: "text" | "project-manager-plan-review";
306
+ humanAssistanceRequests: (({
307
+ type: "text";
308
+ question: {
309
+ type: "text";
310
+ question: string;
311
+ };
312
+ } | {
313
+ type: "project-manager-plan-review";
314
+ question: {
315
+ type: "project-manager-plan-review";
316
+ tasks: {
317
+ expectedOutput: string;
318
+ input: string;
319
+ index: number;
320
+ assigneeAgentId: number;
321
+ assigneeAgentName: string;
322
+ taskDescription: string;
323
+ taskBody: string;
324
+ }[];
325
+ };
326
+ } | {
327
+ type: "insufficient-balance";
328
+ question: {
329
+ type: "insufficient-balance";
330
+ };
331
+ } | {
332
+ type: "json";
333
+ question?: any;
334
+ }) & {
155
335
  status: "pending" | "responded";
156
336
  id: number;
157
- question: string;
158
337
  agentDump?: unknown;
159
338
  humanResponse?: string | null | undefined;
160
- }[];
339
+ })[];
161
340
  body?: string | null | undefined;
162
341
  expectedOutput?: string | null | undefined;
163
342
  input?: string | null | undefined;
@@ -281,14 +460,40 @@ export declare const doTaskActionSchema: z.ZodObject<{
281
460
  }[];
282
461
  output?: string | null | undefined;
283
462
  }[];
284
- humanAssistanceRequests: {
285
- type: "text" | "project-manager-plan-review";
463
+ humanAssistanceRequests: (({
464
+ type: "text";
465
+ question: {
466
+ type: "text";
467
+ question: string;
468
+ };
469
+ } | {
470
+ type: "project-manager-plan-review";
471
+ question: {
472
+ type: "project-manager-plan-review";
473
+ tasks: {
474
+ expectedOutput: string;
475
+ input: string;
476
+ index: number;
477
+ assigneeAgentId: number;
478
+ assigneeAgentName: string;
479
+ taskDescription: string;
480
+ taskBody: string;
481
+ }[];
482
+ };
483
+ } | {
484
+ type: "insufficient-balance";
485
+ question: {
486
+ type: "insufficient-balance";
487
+ };
488
+ } | {
489
+ type: "json";
490
+ question?: any;
491
+ }) & {
286
492
  status: "pending" | "responded";
287
493
  id: number;
288
- question: string;
289
494
  agentDump?: unknown;
290
495
  humanResponse?: string | null | undefined;
291
- }[];
496
+ })[];
292
497
  body?: string | null | undefined;
293
498
  expectedOutput?: string | null | undefined;
294
499
  input?: string | null | undefined;
@@ -348,14 +553,40 @@ export declare const doTaskActionSchema: z.ZodObject<{
348
553
  }[];
349
554
  output?: string | null | undefined;
350
555
  }[];
351
- humanAssistanceRequests: {
352
- type: "text" | "project-manager-plan-review";
556
+ humanAssistanceRequests: (({
557
+ type: "text";
558
+ question: {
559
+ type: "text";
560
+ question: string;
561
+ };
562
+ } | {
563
+ type: "project-manager-plan-review";
564
+ question: {
565
+ type: "project-manager-plan-review";
566
+ tasks: {
567
+ expectedOutput: string;
568
+ input: string;
569
+ index: number;
570
+ assigneeAgentId: number;
571
+ assigneeAgentName: string;
572
+ taskDescription: string;
573
+ taskBody: string;
574
+ }[];
575
+ };
576
+ } | {
577
+ type: "insufficient-balance";
578
+ question: {
579
+ type: "insufficient-balance";
580
+ };
581
+ } | {
582
+ type: "json";
583
+ question?: any;
584
+ }) & {
353
585
  status: "pending" | "responded";
354
586
  id: number;
355
- question: string;
356
587
  agentDump?: unknown;
357
588
  humanResponse?: string | null | undefined;
358
- }[];
589
+ })[];
359
590
  body?: string | null | undefined;
360
591
  expectedOutput?: string | null | undefined;
361
592
  input?: string | null | undefined;
@@ -700,28 +931,155 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
700
931
  }[];
701
932
  output?: string | null | undefined;
702
933
  }>, "many">;
703
- humanAssistanceRequests: z.ZodArray<z.ZodObject<{
934
+ humanAssistanceRequests: z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
935
+ type: z.ZodLiteral<"text">;
936
+ question: z.ZodObject<{
937
+ type: z.ZodLiteral<"text">;
938
+ question: z.ZodString;
939
+ }, "strip", z.ZodTypeAny, {
940
+ type: "text";
941
+ question: string;
942
+ }, {
943
+ type: "text";
944
+ question: string;
945
+ }>;
946
+ }, "strip", z.ZodTypeAny, {
947
+ type: "text";
948
+ question: {
949
+ type: "text";
950
+ question: string;
951
+ };
952
+ }, {
953
+ type: "text";
954
+ question: {
955
+ type: "text";
956
+ question: string;
957
+ };
958
+ }>, z.ZodObject<{
959
+ type: z.ZodLiteral<"project-manager-plan-review">;
960
+ question: z.ZodObject<z.objectUtil.extendShape<{
961
+ tasks: z.ZodArray<z.ZodObject<{
962
+ index: z.ZodNumber;
963
+ assigneeAgentId: z.ZodNumber;
964
+ assigneeAgentName: z.ZodString;
965
+ taskDescription: z.ZodString;
966
+ taskBody: z.ZodString;
967
+ input: z.ZodString;
968
+ expectedOutput: z.ZodString;
969
+ }, "strip", z.ZodTypeAny, {
970
+ expectedOutput: string;
971
+ input: string;
972
+ index: number;
973
+ assigneeAgentId: number;
974
+ assigneeAgentName: string;
975
+ taskDescription: string;
976
+ taskBody: string;
977
+ }, {
978
+ expectedOutput: string;
979
+ input: string;
980
+ index: number;
981
+ assigneeAgentId: number;
982
+ assigneeAgentName: string;
983
+ taskDescription: string;
984
+ taskBody: string;
985
+ }>, "many">;
986
+ }, {
987
+ type: z.ZodLiteral<"project-manager-plan-review">;
988
+ }>, "strip", z.ZodTypeAny, {
989
+ type: "project-manager-plan-review";
990
+ tasks: {
991
+ expectedOutput: string;
992
+ input: string;
993
+ index: number;
994
+ assigneeAgentId: number;
995
+ assigneeAgentName: string;
996
+ taskDescription: string;
997
+ taskBody: string;
998
+ }[];
999
+ }, {
1000
+ type: "project-manager-plan-review";
1001
+ tasks: {
1002
+ expectedOutput: string;
1003
+ input: string;
1004
+ index: number;
1005
+ assigneeAgentId: number;
1006
+ assigneeAgentName: string;
1007
+ taskDescription: string;
1008
+ taskBody: string;
1009
+ }[];
1010
+ }>;
1011
+ }, "strip", z.ZodTypeAny, {
1012
+ type: "project-manager-plan-review";
1013
+ question: {
1014
+ type: "project-manager-plan-review";
1015
+ tasks: {
1016
+ expectedOutput: string;
1017
+ input: string;
1018
+ index: number;
1019
+ assigneeAgentId: number;
1020
+ assigneeAgentName: string;
1021
+ taskDescription: string;
1022
+ taskBody: string;
1023
+ }[];
1024
+ };
1025
+ }, {
1026
+ type: "project-manager-plan-review";
1027
+ question: {
1028
+ type: "project-manager-plan-review";
1029
+ tasks: {
1030
+ expectedOutput: string;
1031
+ input: string;
1032
+ index: number;
1033
+ assigneeAgentId: number;
1034
+ assigneeAgentName: string;
1035
+ taskDescription: string;
1036
+ taskBody: string;
1037
+ }[];
1038
+ };
1039
+ }>, z.ZodObject<{
1040
+ type: z.ZodLiteral<"insufficient-balance">;
1041
+ question: z.ZodObject<{
1042
+ type: z.ZodLiteral<"insufficient-balance">;
1043
+ }, "strip", z.ZodTypeAny, {
1044
+ type: "insufficient-balance";
1045
+ }, {
1046
+ type: "insufficient-balance";
1047
+ }>;
1048
+ }, "strip", z.ZodTypeAny, {
1049
+ type: "insufficient-balance";
1050
+ question: {
1051
+ type: "insufficient-balance";
1052
+ };
1053
+ }, {
1054
+ type: "insufficient-balance";
1055
+ question: {
1056
+ type: "insufficient-balance";
1057
+ };
1058
+ }>, z.ZodObject<{
1059
+ type: z.ZodLiteral<"json">;
1060
+ question: z.ZodAny;
1061
+ }, "strip", z.ZodTypeAny, {
1062
+ type: "json";
1063
+ question?: any;
1064
+ }, {
1065
+ type: "json";
1066
+ question?: any;
1067
+ }>]>, z.ZodObject<{
704
1068
  agentDump: z.ZodUnknown;
705
1069
  humanResponse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
706
1070
  id: z.ZodNumber;
707
- question: z.ZodString;
708
1071
  status: z.ZodEnum<["pending", "responded"]>;
709
- type: z.ZodEnum<["text", "project-manager-plan-review"]>;
710
1072
  }, "strip", z.ZodTypeAny, {
711
- type: "text" | "project-manager-plan-review";
712
1073
  status: "pending" | "responded";
713
1074
  id: number;
714
- question: string;
715
1075
  agentDump?: unknown;
716
1076
  humanResponse?: string | null | undefined;
717
1077
  }, {
718
- type: "text" | "project-manager-plan-review";
719
1078
  status: "pending" | "responded";
720
1079
  id: number;
721
- question: string;
722
1080
  agentDump?: unknown;
723
1081
  humanResponse?: string | null | undefined;
724
- }>, "many">;
1082
+ }>>, "many">;
725
1083
  }, "strip", z.ZodTypeAny, {
726
1084
  description: string;
727
1085
  id: number;
@@ -737,14 +1095,40 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
737
1095
  }[];
738
1096
  output?: string | null | undefined;
739
1097
  }[];
740
- humanAssistanceRequests: {
741
- type: "text" | "project-manager-plan-review";
1098
+ humanAssistanceRequests: (({
1099
+ type: "text";
1100
+ question: {
1101
+ type: "text";
1102
+ question: string;
1103
+ };
1104
+ } | {
1105
+ type: "project-manager-plan-review";
1106
+ question: {
1107
+ type: "project-manager-plan-review";
1108
+ tasks: {
1109
+ expectedOutput: string;
1110
+ input: string;
1111
+ index: number;
1112
+ assigneeAgentId: number;
1113
+ assigneeAgentName: string;
1114
+ taskDescription: string;
1115
+ taskBody: string;
1116
+ }[];
1117
+ };
1118
+ } | {
1119
+ type: "insufficient-balance";
1120
+ question: {
1121
+ type: "insufficient-balance";
1122
+ };
1123
+ } | {
1124
+ type: "json";
1125
+ question?: any;
1126
+ }) & {
742
1127
  status: "pending" | "responded";
743
1128
  id: number;
744
- question: string;
745
1129
  agentDump?: unknown;
746
1130
  humanResponse?: string | null | undefined;
747
- }[];
1131
+ })[];
748
1132
  body?: string | null | undefined;
749
1133
  expectedOutput?: string | null | undefined;
750
1134
  input?: string | null | undefined;
@@ -763,14 +1147,40 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
763
1147
  }[];
764
1148
  output?: string | null | undefined;
765
1149
  }[];
766
- humanAssistanceRequests: {
767
- type: "text" | "project-manager-plan-review";
1150
+ humanAssistanceRequests: (({
1151
+ type: "text";
1152
+ question: {
1153
+ type: "text";
1154
+ question: string;
1155
+ };
1156
+ } | {
1157
+ type: "project-manager-plan-review";
1158
+ question: {
1159
+ type: "project-manager-plan-review";
1160
+ tasks: {
1161
+ expectedOutput: string;
1162
+ input: string;
1163
+ index: number;
1164
+ assigneeAgentId: number;
1165
+ assigneeAgentName: string;
1166
+ taskDescription: string;
1167
+ taskBody: string;
1168
+ }[];
1169
+ };
1170
+ } | {
1171
+ type: "insufficient-balance";
1172
+ question: {
1173
+ type: "insufficient-balance";
1174
+ };
1175
+ } | {
1176
+ type: "json";
1177
+ question?: any;
1178
+ }) & {
768
1179
  status: "pending" | "responded";
769
1180
  id: number;
770
- question: string;
771
1181
  agentDump?: unknown;
772
1182
  humanResponse?: string | null | undefined;
773
- }[];
1183
+ })[];
774
1184
  body?: string | null | undefined;
775
1185
  expectedOutput?: string | null | undefined;
776
1186
  input?: string | null | undefined;
@@ -894,14 +1304,40 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
894
1304
  }[];
895
1305
  output?: string | null | undefined;
896
1306
  }[];
897
- humanAssistanceRequests: {
898
- type: "text" | "project-manager-plan-review";
1307
+ humanAssistanceRequests: (({
1308
+ type: "text";
1309
+ question: {
1310
+ type: "text";
1311
+ question: string;
1312
+ };
1313
+ } | {
1314
+ type: "project-manager-plan-review";
1315
+ question: {
1316
+ type: "project-manager-plan-review";
1317
+ tasks: {
1318
+ expectedOutput: string;
1319
+ input: string;
1320
+ index: number;
1321
+ assigneeAgentId: number;
1322
+ assigneeAgentName: string;
1323
+ taskDescription: string;
1324
+ taskBody: string;
1325
+ }[];
1326
+ };
1327
+ } | {
1328
+ type: "insufficient-balance";
1329
+ question: {
1330
+ type: "insufficient-balance";
1331
+ };
1332
+ } | {
1333
+ type: "json";
1334
+ question?: any;
1335
+ }) & {
899
1336
  status: "pending" | "responded";
900
1337
  id: number;
901
- question: string;
902
1338
  agentDump?: unknown;
903
1339
  humanResponse?: string | null | undefined;
904
- }[];
1340
+ })[];
905
1341
  body?: string | null | undefined;
906
1342
  expectedOutput?: string | null | undefined;
907
1343
  input?: string | null | undefined;
@@ -961,14 +1397,40 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
961
1397
  }[];
962
1398
  output?: string | null | undefined;
963
1399
  }[];
964
- humanAssistanceRequests: {
965
- type: "text" | "project-manager-plan-review";
1400
+ humanAssistanceRequests: (({
1401
+ type: "text";
1402
+ question: {
1403
+ type: "text";
1404
+ question: string;
1405
+ };
1406
+ } | {
1407
+ type: "project-manager-plan-review";
1408
+ question: {
1409
+ type: "project-manager-plan-review";
1410
+ tasks: {
1411
+ expectedOutput: string;
1412
+ input: string;
1413
+ index: number;
1414
+ assigneeAgentId: number;
1415
+ assigneeAgentName: string;
1416
+ taskDescription: string;
1417
+ taskBody: string;
1418
+ }[];
1419
+ };
1420
+ } | {
1421
+ type: "insufficient-balance";
1422
+ question: {
1423
+ type: "insufficient-balance";
1424
+ };
1425
+ } | {
1426
+ type: "json";
1427
+ question?: any;
1428
+ }) & {
966
1429
  status: "pending" | "responded";
967
1430
  id: number;
968
- question: string;
969
1431
  agentDump?: unknown;
970
1432
  humanResponse?: string | null | undefined;
971
- }[];
1433
+ })[];
972
1434
  body?: string | null | undefined;
973
1435
  expectedOutput?: string | null | undefined;
974
1436
  input?: string | null | undefined;
@@ -1232,9 +1694,67 @@ export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1232
1694
  author: "agent" | "user";
1233
1695
  }[];
1234
1696
  }>]>;
1697
+ declare const agentChatMessagesResponseSchema: z.ZodObject<{
1698
+ agent: z.ZodObject<{
1699
+ id: z.ZodNumber;
1700
+ name: z.ZodString;
1701
+ }, "strip", z.ZodTypeAny, {
1702
+ name: string;
1703
+ id: number;
1704
+ }, {
1705
+ name: string;
1706
+ id: number;
1707
+ }>;
1708
+ messages: z.ZodArray<z.ZodObject<{
1709
+ author: z.ZodEnum<["agent", "user"]>;
1710
+ createdAt: z.ZodDate;
1711
+ id: z.ZodNumber;
1712
+ message: z.ZodString;
1713
+ }, "strip", z.ZodTypeAny, {
1714
+ message: string;
1715
+ id: number;
1716
+ createdAt: Date;
1717
+ author: "agent" | "user";
1718
+ }, {
1719
+ message: string;
1720
+ id: number;
1721
+ createdAt: Date;
1722
+ author: "agent" | "user";
1723
+ }>, "many">;
1724
+ }, "strip", z.ZodTypeAny, {
1725
+ messages: {
1726
+ message: string;
1727
+ id: number;
1728
+ createdAt: Date;
1729
+ author: "agent" | "user";
1730
+ }[];
1731
+ agent: {
1732
+ name: string;
1733
+ id: number;
1734
+ };
1735
+ }, {
1736
+ messages: {
1737
+ message: string;
1738
+ id: number;
1739
+ createdAt: Date;
1740
+ author: "agent" | "user";
1741
+ }[];
1742
+ agent: {
1743
+ name: string;
1744
+ id: number;
1745
+ };
1746
+ }>;
1747
+ export type AgentChatMessagesResponse = z.infer<typeof agentChatMessagesResponseSchema>;
1235
1748
  export interface GetFilesParams {
1236
1749
  workspaceId: number;
1237
1750
  }
1751
+ export interface GetSecretsParams {
1752
+ workspaceId: number;
1753
+ }
1754
+ export interface GetSecretValueParams {
1755
+ workspaceId: number;
1756
+ secretId: number;
1757
+ }
1238
1758
  export declare const getFilesParamsSchema: z.ZodObject<{
1239
1759
  workspaceId: z.ZodNumber;
1240
1760
  }, "strip", z.ZodTypeAny, {
@@ -1271,6 +1791,10 @@ export interface GetTaskDetailParams {
1271
1791
  export interface GetAgentsParams {
1272
1792
  workspaceId: number;
1273
1793
  }
1794
+ export interface GetChatMessagesParams {
1795
+ workspaceId: number;
1796
+ agentId: number;
1797
+ }
1274
1798
  export interface GetTasksParams {
1275
1799
  workspaceId: number;
1276
1800
  }
@@ -1324,4 +1848,5 @@ export interface IntegrationCallRequest {
1324
1848
  integrationId: string;
1325
1849
  details: ProxyConfiguration;
1326
1850
  }
1851
+ export {};
1327
1852
  //# 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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UAAU,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,0BAA0B,EAAE,CAAA;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAA;IAClG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;IACjD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,eAAe,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/dist/types.js CHANGED
@@ -8,6 +8,46 @@ exports.agentKind = zod_1.z.enum(['external', 'eliza', 'openserv']);
8
8
  exports.taskStatusSchema = zod_1.z
9
9
  .enum(['to-do', 'in-progress', 'human-assistance-required', 'error', 'done', 'cancelled'])
10
10
  .openapi('taskStatusSchema');
11
+ const projectManagerPlanReviewHumanAssistanceQuestionSchema = zod_1.z.object({
12
+ tasks: zod_1.z.array(zod_1.z.object({
13
+ index: zod_1.z.number(),
14
+ assigneeAgentId: zod_1.z.number().int(),
15
+ assigneeAgentName: zod_1.z.string(),
16
+ taskDescription: zod_1.z.string(),
17
+ taskBody: zod_1.z.string(),
18
+ input: zod_1.z.string(),
19
+ expectedOutput: zod_1.z.string()
20
+ }))
21
+ });
22
+ const baseHumanAssistanceRequestSchema = zod_1.z.discriminatedUnion('type', [
23
+ zod_1.z
24
+ .object({
25
+ type: zod_1.z.literal('text'),
26
+ question: zod_1.z.object({
27
+ type: zod_1.z.literal('text'),
28
+ question: zod_1.z.string().trim().min(1).openapi({ description: 'Your question for the user' })
29
+ })
30
+ })
31
+ .openapi({
32
+ description: "The type is 'text' and the question is a known object. This is what your agents will typically use."
33
+ }),
34
+ zod_1.z.object({
35
+ type: zod_1.z.literal('project-manager-plan-review'),
36
+ question: projectManagerPlanReviewHumanAssistanceQuestionSchema.extend({
37
+ type: zod_1.z.literal('project-manager-plan-review')
38
+ })
39
+ }),
40
+ zod_1.z.object({
41
+ type: zod_1.z.literal('insufficient-balance'),
42
+ question: zod_1.z.object({
43
+ type: zod_1.z.literal('insufficient-balance')
44
+ })
45
+ }),
46
+ zod_1.z.object({
47
+ type: zod_1.z.literal('json'),
48
+ question: zod_1.z.any()
49
+ })
50
+ ]);
11
51
  exports.doTaskActionSchema = zod_1.z
12
52
  .object({
13
53
  type: zod_1.z.literal('do-task'),
@@ -56,7 +96,7 @@ exports.doTaskActionSchema = zod_1.z
56
96
  }))
57
97
  }))
58
98
  .openapi({ description: 'List of dependant tasks' }),
59
- humanAssistanceRequests: zod_1.z.array(zod_1.z
99
+ humanAssistanceRequests: zod_1.z.array(zod_1.z.intersection(baseHumanAssistanceRequestSchema, zod_1.z
60
100
  .object({
61
101
  agentDump: zod_1.z.unknown().openapi({
62
102
  description: "Agent's internal data. Anything the agent wanted to store in the context of this human assistant request."
@@ -66,13 +106,9 @@ exports.doTaskActionSchema = zod_1.z
66
106
  .nullish()
67
107
  .openapi({ description: "Human's response to the question" }),
68
108
  id: zod_1.z.number(),
69
- question: zod_1.z.string().openapi({ description: "Agent's question for the user" }),
70
- status: zod_1.z.enum(['pending', 'responded']),
71
- type: zod_1.z.enum(['text', 'project-manager-plan-review']).openapi({
72
- description: "'project-manager-plan-review' is initiaded by a Project Manager agent to let the user confirm the project plan for this workspace."
73
- })
109
+ status: zod_1.z.enum(['pending', 'responded'])
74
110
  })
75
- .openapi({ description: 'List of Human Assistance Requests' }))
111
+ .openapi({ description: 'List of Human Assistance Requests' })))
76
112
  }),
77
113
  workspace: zod_1.z.object({
78
114
  id: zod_1.z.number(),
@@ -160,6 +196,18 @@ exports.actionSchema = zod_1.z.discriminatedUnion('type', [
160
196
  exports.doTaskActionSchema,
161
197
  exports.respondChatMessageActionSchema
162
198
  ]);
199
+ const agentChatMessagesResponseSchema = zod_1.z.object({
200
+ agent: zod_1.z.object({
201
+ id: zod_1.z.number(),
202
+ name: zod_1.z.string()
203
+ }),
204
+ messages: zod_1.z.array(zod_1.z.object({
205
+ author: zod_1.z.enum(['agent', 'user']),
206
+ createdAt: zod_1.z.coerce.date(),
207
+ id: zod_1.z.number(),
208
+ message: zod_1.z.string()
209
+ }))
210
+ });
163
211
  exports.getFilesParamsSchema = zod_1.z.object({
164
212
  workspaceId: zod_1.z.number().int().positive()
165
213
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openserv-labs/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "OpenServ Agent SDK - Create AI agents easily",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,6 +44,7 @@
44
44
  "@asteasolutions/zod-to-openapi": "^7.3.0",
45
45
  "axios": "^1.6.8",
46
46
  "axios-retry": "^4.1.0",
47
+ "bcryptjs": "^3.0.2",
47
48
  "compression": "^1.7.4",
48
49
  "express": "^4.19.2",
49
50
  "express-async-router": "^0.1.15",
@@ -67,6 +68,7 @@
67
68
  "eslint": "^8.56.0",
68
69
  "eslint-config-prettier": "^9.1.0",
69
70
  "eslint-plugin-prettier": "^5.1.3",
71
+ "pino-pretty": "^13.0.0",
70
72
  "prettier": "^3.2.5",
71
73
  "ts-node-dev": "^2.0.0",
72
74
  "tsx": "^4.19.2",