@elizaos/api-client 1.6.4-alpha.2 → 1.6.4-alpha.20
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 +54 -0
- package/dist/api-client/src/client.d.ts +2 -0
- package/dist/api-client/src/client.d.ts.map +1 -1
- package/dist/api-client/src/index.d.ts +2 -0
- package/dist/api-client/src/index.d.ts.map +1 -1
- package/dist/api-client/src/services/jobs.d.ts +221 -0
- package/dist/api-client/src/services/jobs.d.ts.map +1 -0
- package/dist/api-client/src/types/jobs.d.ts +155 -0
- package/dist/api-client/src/types/jobs.d.ts.map +1 -0
- package/dist/core/src/elizaos.d.ts +119 -16
- package/dist/core/src/elizaos.d.ts.map +1 -1
- package/dist/core/src/runtime.d.ts +3 -1
- package/dist/core/src/runtime.d.ts.map +1 -1
- package/dist/core/src/secrets.d.ts.map +1 -1
- package/dist/core/src/types/components.d.ts +2 -0
- package/dist/core/src/types/components.d.ts.map +1 -1
- package/dist/core/src/types/messaging.d.ts +42 -0
- package/dist/core/src/types/messaging.d.ts.map +1 -1
- package/dist/core/src/types/runtime.d.ts +3 -1
- package/dist/core/src/types/runtime.d.ts.map +1 -1
- package/dist/index.js +165 -1
- package/dist/index.js.map +6 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -48,6 +48,10 @@ const upload = await client.media.uploadAgentMedia(agentId, {
|
|
|
48
48
|
file: myFile,
|
|
49
49
|
filename: 'image.png',
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
// Quick one-off message with automatic polling (Jobs API)
|
|
53
|
+
const response = await client.jobs.ask('user-123', 'What is Bitcoin?');
|
|
54
|
+
console.log('Agent response:', response);
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
## API Domains
|
|
@@ -73,6 +77,56 @@ const upload = await client.media.uploadAgentMedia(agentId, {
|
|
|
73
77
|
- Session metadata and lifecycle management
|
|
74
78
|
- Automatic cleanup of inactive sessions
|
|
75
79
|
|
|
80
|
+
### Jobs
|
|
81
|
+
|
|
82
|
+
- One-off messaging with automatic response handling
|
|
83
|
+
- Simple request/response pattern for agent interactions
|
|
84
|
+
- Automatic polling with customizable strategies
|
|
85
|
+
- Job status tracking and health metrics
|
|
86
|
+
|
|
87
|
+
Example:
|
|
88
|
+
```typescript
|
|
89
|
+
// Simple ask pattern - returns the response directly
|
|
90
|
+
const response = await client.jobs.ask('user-id', 'What is Bitcoin?');
|
|
91
|
+
|
|
92
|
+
// Create and poll manually for more control
|
|
93
|
+
const result = await client.jobs.createAndPoll({
|
|
94
|
+
userId: 'user-id',
|
|
95
|
+
content: 'Complex analysis query',
|
|
96
|
+
agentId: 'specific-agent-id', // Optional
|
|
97
|
+
timeoutMs: 60000, // Optional
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
if (result.success) {
|
|
101
|
+
console.log('Response:', result.job.result?.message.content);
|
|
102
|
+
console.log('Processing time:', result.job.result?.processingTimeMs, 'ms');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Poll with exponential backoff for long-running queries
|
|
106
|
+
const backoffResult = await client.jobs.createAndPollWithBackoff({
|
|
107
|
+
userId: 'user-id',
|
|
108
|
+
content: 'Long running task',
|
|
109
|
+
}, {
|
|
110
|
+
initialInterval: 500,
|
|
111
|
+
maxInterval: 5000,
|
|
112
|
+
multiplier: 1.5,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Get job status manually
|
|
116
|
+
const job = await client.jobs.getJob('job-id');
|
|
117
|
+
console.log('Status:', job.status);
|
|
118
|
+
|
|
119
|
+
// List all jobs
|
|
120
|
+
const { jobs } = await client.jobs.list({
|
|
121
|
+
status: JobStatus.COMPLETED,
|
|
122
|
+
limit: 10
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Check health metrics
|
|
126
|
+
const health = await client.jobs.health();
|
|
127
|
+
console.log('Success rate:', health.metrics.successRate);
|
|
128
|
+
```
|
|
129
|
+
|
|
76
130
|
### Memory
|
|
77
131
|
|
|
78
132
|
- Agent memory management
|
|
@@ -8,6 +8,7 @@ import { ServerService } from './services/server';
|
|
|
8
8
|
import { SystemService } from './services/system';
|
|
9
9
|
import { SessionsService } from './services/sessions';
|
|
10
10
|
import { RunsService } from './services/runs';
|
|
11
|
+
import { JobsService } from './services/jobs';
|
|
11
12
|
export declare class ElizaClient {
|
|
12
13
|
readonly agents: AgentsService;
|
|
13
14
|
readonly messaging: MessagingService;
|
|
@@ -18,6 +19,7 @@ export declare class ElizaClient {
|
|
|
18
19
|
readonly system: SystemService;
|
|
19
20
|
readonly sessions: SessionsService;
|
|
20
21
|
readonly runs: RunsService;
|
|
22
|
+
readonly jobs: JobsService;
|
|
21
23
|
constructor(config: ApiClientConfig);
|
|
22
24
|
/**
|
|
23
25
|
* Create a new ElizaClient instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,qBAAa,WAAW;IACtB,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,SAAS,EAAE,gBAAgB,CAAC;IAC5C,SAAgB,MAAM,EAAE,aAA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,IAAI,EAAE,WAAW,CAAC;IAClC,SAAgB,IAAI,EAAE,WAAW,CAAC;gBAEtB,MAAM,EAAE,eAAe;IAcnC;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW;CAGpD"}
|
|
@@ -9,6 +9,7 @@ export * from './types/server';
|
|
|
9
9
|
export * from './types/system';
|
|
10
10
|
export * from './types/sessions';
|
|
11
11
|
export * from './types/runs';
|
|
12
|
+
export * from './types/jobs';
|
|
12
13
|
export { AgentsService } from './services/agents';
|
|
13
14
|
export { MessagingService } from './services/messaging';
|
|
14
15
|
export { MemoryService } from './services/memory';
|
|
@@ -18,5 +19,6 @@ export { ServerService } from './services/server';
|
|
|
18
19
|
export { SystemService } from './services/system';
|
|
19
20
|
export { SessionsService } from './services/sessions';
|
|
20
21
|
export { RunsService } from './services/runs';
|
|
22
|
+
export { JobsService } from './services/jobs';
|
|
21
23
|
export { BaseApiClient, ApiError } from './lib/base-client';
|
|
22
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY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AAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { UUID } from '@elizaos/core';
|
|
2
|
+
import { BaseApiClient } from '../lib/base-client';
|
|
3
|
+
import { CreateJobRequest, CreateJobResponse, JobDetailsResponse, JobHealthResponse, JobListResponse, ListJobsParams, PollOptions, PollResult } from '../types/jobs';
|
|
4
|
+
/**
|
|
5
|
+
* Jobs API Service - One-off messaging with automatic polling support
|
|
6
|
+
*
|
|
7
|
+
* The Jobs API provides a simplified interface for one-off messages to agents
|
|
8
|
+
* with automatic response handling and polling capabilities.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const client = new ElizaClient({ baseUrl: 'http://localhost:3000' });
|
|
13
|
+
*
|
|
14
|
+
* // Create a job and poll for completion
|
|
15
|
+
* const result = await client.jobs.createAndPoll({
|
|
16
|
+
* userId: 'user-uuid',
|
|
17
|
+
* content: 'What is the weather today?'
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* console.log('Agent response:', result.job.result?.message.content);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class JobsService extends BaseApiClient {
|
|
24
|
+
/**
|
|
25
|
+
* Create a new job (one-off message to agent)
|
|
26
|
+
*
|
|
27
|
+
* @param params - Job creation parameters
|
|
28
|
+
* @returns Job creation response with jobId and initial status
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const job = await client.jobs.create({
|
|
33
|
+
* userId: 'user-uuid',
|
|
34
|
+
* content: 'What is Bitcoin price?',
|
|
35
|
+
* agentId: 'agent-uuid', // Optional - uses first available if not provided
|
|
36
|
+
* timeoutMs: 60000, // Optional - default 30 seconds
|
|
37
|
+
* metadata: { source: 'mobile-app' } // Optional
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* console.log('Job created:', job.jobId);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
create(params: CreateJobRequest): Promise<CreateJobResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Get job status and details
|
|
46
|
+
*
|
|
47
|
+
* @param jobId - The job ID to retrieve
|
|
48
|
+
* @returns Current job status and details
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const job = await client.jobs.getJob('job-id-123');
|
|
53
|
+
*
|
|
54
|
+
* if (job.status === JobStatus.COMPLETED) {
|
|
55
|
+
* console.log('Response:', job.result?.message.content);
|
|
56
|
+
* } else if (job.status === JobStatus.FAILED) {
|
|
57
|
+
* console.error('Error:', job.error);
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
getJob(jobId: string): Promise<JobDetailsResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* List jobs with optional filtering
|
|
64
|
+
*
|
|
65
|
+
* @param params - Optional filtering and pagination parameters
|
|
66
|
+
* @returns List of jobs matching the criteria
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* // Get all completed jobs
|
|
71
|
+
* const completedJobs = await client.jobs.list({
|
|
72
|
+
* status: JobStatus.COMPLETED,
|
|
73
|
+
* limit: 10
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // Get all jobs (default limit: 50)
|
|
77
|
+
* const allJobs = await client.jobs.list();
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
list(params?: ListJobsParams): Promise<JobListResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Get jobs API health status and metrics
|
|
83
|
+
*
|
|
84
|
+
* @returns Health status with metrics
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const health = await client.jobs.health();
|
|
89
|
+
* console.log('Success rate:', health.metrics.successRate);
|
|
90
|
+
* console.log('Active jobs:', health.statusCounts.processing);
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
health(): Promise<JobHealthResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* Poll a job until completion, failure, or timeout
|
|
96
|
+
*
|
|
97
|
+
* This is a convenience method that handles polling logic automatically.
|
|
98
|
+
* It will continue polling until the job reaches a terminal state (completed, failed, or timeout).
|
|
99
|
+
*
|
|
100
|
+
* @param jobId - The job ID to poll
|
|
101
|
+
* @param options - Polling configuration options
|
|
102
|
+
* @returns Poll result with final job status
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const result = await client.jobs.poll('job-id-123', {
|
|
107
|
+
* interval: 1000, // Poll every second
|
|
108
|
+
* maxAttempts: 30, // Give up after 30 attempts
|
|
109
|
+
* onProgress: (job, attempt) => {
|
|
110
|
+
* console.log(`Attempt ${attempt}: ${job.status}`);
|
|
111
|
+
* }
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* if (result.success) {
|
|
115
|
+
* console.log('Response:', result.job.result?.message.content);
|
|
116
|
+
* } else {
|
|
117
|
+
* console.error('Failed:', result.job.error);
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
poll(jobId: string, options?: PollOptions): Promise<PollResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Create a job and automatically poll until completion
|
|
124
|
+
*
|
|
125
|
+
* This is the most convenient method for simple use cases where you want to
|
|
126
|
+
* send a message and wait for the response in one call.
|
|
127
|
+
*
|
|
128
|
+
* @param params - Job creation parameters
|
|
129
|
+
* @param pollOptions - Optional polling configuration
|
|
130
|
+
* @returns Poll result with final job status
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* // Simple usage
|
|
135
|
+
* const result = await client.jobs.createAndPoll({
|
|
136
|
+
* userId: 'user-uuid',
|
|
137
|
+
* content: 'What is the weather today?'
|
|
138
|
+
* });
|
|
139
|
+
*
|
|
140
|
+
* if (result.success) {
|
|
141
|
+
* console.log('Agent:', result.job.result?.message.content);
|
|
142
|
+
* }
|
|
143
|
+
*
|
|
144
|
+
* // With custom polling options
|
|
145
|
+
* const result = await client.jobs.createAndPoll(
|
|
146
|
+
* {
|
|
147
|
+
* userId: 'user-uuid',
|
|
148
|
+
* content: 'Complex analysis query',
|
|
149
|
+
* timeoutMs: 120000
|
|
150
|
+
* },
|
|
151
|
+
* {
|
|
152
|
+
* interval: 2000,
|
|
153
|
+
* timeout: 120000,
|
|
154
|
+
* onProgress: (job, attempt) => {
|
|
155
|
+
* console.log(`Waiting... (${attempt})`);
|
|
156
|
+
* }
|
|
157
|
+
* }
|
|
158
|
+
* );
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
createAndPoll(params: CreateJobRequest, pollOptions?: PollOptions): Promise<PollResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Create a job and wait for completion with exponential backoff
|
|
164
|
+
*
|
|
165
|
+
* Similar to createAndPoll but uses exponential backoff for polling,
|
|
166
|
+
* which can be more efficient for longer-running jobs.
|
|
167
|
+
*
|
|
168
|
+
* @param params - Job creation parameters
|
|
169
|
+
* @param options - Backoff configuration
|
|
170
|
+
* @returns Poll result with final job status
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const result = await client.jobs.createAndPollWithBackoff({
|
|
175
|
+
* userId: 'user-uuid',
|
|
176
|
+
* content: 'Analyze this complex data set'
|
|
177
|
+
* }, {
|
|
178
|
+
* initialInterval: 500,
|
|
179
|
+
* maxInterval: 5000,
|
|
180
|
+
* multiplier: 1.5,
|
|
181
|
+
* maxAttempts: 40
|
|
182
|
+
* });
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
createAndPollWithBackoff(params: CreateJobRequest, options?: {
|
|
186
|
+
initialInterval?: number;
|
|
187
|
+
maxInterval?: number;
|
|
188
|
+
multiplier?: number;
|
|
189
|
+
maxAttempts?: number;
|
|
190
|
+
timeout?: number;
|
|
191
|
+
onProgress?: (status: JobDetailsResponse, attempt: number) => void;
|
|
192
|
+
}): Promise<PollResult>;
|
|
193
|
+
/**
|
|
194
|
+
* Convenience method to ask a question and get the response
|
|
195
|
+
*
|
|
196
|
+
* This is a simplified interface that abstracts away the job ID and returns
|
|
197
|
+
* the agent's response content directly. Throws an error if the job fails.
|
|
198
|
+
*
|
|
199
|
+
* @param userId - User ID sending the message
|
|
200
|
+
* @param content - Message content/question
|
|
201
|
+
* @param agentId - Optional agent ID to target
|
|
202
|
+
* @param pollOptions - Optional polling configuration
|
|
203
|
+
* @returns The agent's response content
|
|
204
|
+
* @throws Error if the job fails or times out
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* try {
|
|
209
|
+
* const response = await client.jobs.ask(
|
|
210
|
+
* 'user-uuid',
|
|
211
|
+
* 'What is the price of Bitcoin?'
|
|
212
|
+
* );
|
|
213
|
+
* console.log('Agent says:', response);
|
|
214
|
+
* } catch (error) {
|
|
215
|
+
* console.error('Failed to get response:', error.message);
|
|
216
|
+
* }
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
ask(userId: UUID, content: string, agentId?: UUID, pollOptions?: PollOptions): Promise<string>;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../../src/services/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EAEd,WAAW,EACX,UAAU,EACb,MAAM,eAAe,CAAC;AAEvB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MAAM,EACf,OAAO,CAAC,EAAE,IAAI,EACd,WAAW,CAAC,EAAE,WAAW,GAC1B,OAAO,CAAC,MAAM,CAAC;CAkBrB"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { UUID } from '@elizaos/core';
|
|
2
|
+
/**
|
|
3
|
+
* Job status enumeration
|
|
4
|
+
*/
|
|
5
|
+
export declare enum JobStatus {
|
|
6
|
+
PENDING = "pending",
|
|
7
|
+
PROCESSING = "processing",
|
|
8
|
+
COMPLETED = "completed",
|
|
9
|
+
FAILED = "failed",
|
|
10
|
+
TIMEOUT = "timeout"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Validation constants for job requests
|
|
14
|
+
*/
|
|
15
|
+
export declare const JobValidation: {
|
|
16
|
+
readonly MAX_CONTENT_LENGTH: 50000;
|
|
17
|
+
readonly MAX_METADATA_SIZE: 10000;
|
|
18
|
+
readonly DEFAULT_TIMEOUT_MS: 30000;
|
|
19
|
+
readonly MAX_TIMEOUT_MS: 300000;
|
|
20
|
+
readonly MIN_TIMEOUT_MS: 1000;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Request to create a new job
|
|
24
|
+
*/
|
|
25
|
+
export interface CreateJobRequest {
|
|
26
|
+
/** Agent ID to send the message to (optional - uses first available agent if not provided) */
|
|
27
|
+
agentId?: UUID;
|
|
28
|
+
/** User ID sending the message */
|
|
29
|
+
userId: UUID;
|
|
30
|
+
/** Message content/prompt */
|
|
31
|
+
content: string;
|
|
32
|
+
/** Optional metadata */
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
/** Optional timeout in milliseconds (default: 30000ms, max: 300000ms) */
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Response when creating a job
|
|
39
|
+
*/
|
|
40
|
+
export interface CreateJobResponse {
|
|
41
|
+
/** Unique job identifier */
|
|
42
|
+
jobId: string;
|
|
43
|
+
/** Status of the job */
|
|
44
|
+
status: JobStatus;
|
|
45
|
+
/** Timestamp when job was created */
|
|
46
|
+
createdAt: number;
|
|
47
|
+
/** Estimated timeout time */
|
|
48
|
+
expiresAt: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Job result structure
|
|
52
|
+
*/
|
|
53
|
+
export interface JobResult {
|
|
54
|
+
/** Agent's response message */
|
|
55
|
+
message: {
|
|
56
|
+
id: UUID;
|
|
57
|
+
content: string;
|
|
58
|
+
authorId: UUID;
|
|
59
|
+
createdAt: number;
|
|
60
|
+
metadata?: Record<string, unknown>;
|
|
61
|
+
};
|
|
62
|
+
/** Processing time in milliseconds */
|
|
63
|
+
processingTimeMs: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Job details response
|
|
67
|
+
*/
|
|
68
|
+
export interface JobDetailsResponse {
|
|
69
|
+
/** Unique job identifier */
|
|
70
|
+
jobId: string;
|
|
71
|
+
/** Current status */
|
|
72
|
+
status: JobStatus;
|
|
73
|
+
/** Agent ID */
|
|
74
|
+
agentId: UUID;
|
|
75
|
+
/** User ID */
|
|
76
|
+
userId: UUID;
|
|
77
|
+
/** Original prompt/content */
|
|
78
|
+
prompt: string;
|
|
79
|
+
/** Timestamp when job was created */
|
|
80
|
+
createdAt: number;
|
|
81
|
+
/** Timestamp when job will expire */
|
|
82
|
+
expiresAt: number;
|
|
83
|
+
/** Result (only available when status is COMPLETED) */
|
|
84
|
+
result?: JobResult;
|
|
85
|
+
/** Error message (only available when status is FAILED) */
|
|
86
|
+
error?: string;
|
|
87
|
+
/** Metadata */
|
|
88
|
+
metadata?: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Poll options for checking job status
|
|
92
|
+
*/
|
|
93
|
+
export interface PollOptions {
|
|
94
|
+
/** Polling interval in milliseconds (default: 1000ms) */
|
|
95
|
+
interval?: number;
|
|
96
|
+
/** Maximum number of poll attempts (default: 30) */
|
|
97
|
+
maxAttempts?: number;
|
|
98
|
+
/** Total timeout in milliseconds (overrides maxAttempts if provided) */
|
|
99
|
+
timeout?: number;
|
|
100
|
+
/** Callback function called on each poll attempt */
|
|
101
|
+
onProgress?: (status: JobDetailsResponse, attempt: number) => void;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Health check response with metrics
|
|
105
|
+
*/
|
|
106
|
+
export interface JobHealthResponse {
|
|
107
|
+
healthy: boolean;
|
|
108
|
+
timestamp: number;
|
|
109
|
+
totalJobs: number;
|
|
110
|
+
statusCounts: {
|
|
111
|
+
pending: number;
|
|
112
|
+
processing: number;
|
|
113
|
+
completed: number;
|
|
114
|
+
failed: number;
|
|
115
|
+
timeout: number;
|
|
116
|
+
};
|
|
117
|
+
metrics: {
|
|
118
|
+
averageProcessingTimeMs: number;
|
|
119
|
+
successRate: number;
|
|
120
|
+
failureRate: number;
|
|
121
|
+
timeoutRate: number;
|
|
122
|
+
};
|
|
123
|
+
maxJobs: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Job list response
|
|
127
|
+
*/
|
|
128
|
+
export interface JobListResponse {
|
|
129
|
+
jobs: JobDetailsResponse[];
|
|
130
|
+
total: number;
|
|
131
|
+
filtered: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Parameters for listing jobs
|
|
135
|
+
*/
|
|
136
|
+
export interface ListJobsParams {
|
|
137
|
+
/** Maximum number of jobs to return */
|
|
138
|
+
limit?: number;
|
|
139
|
+
/** Filter by job status */
|
|
140
|
+
status?: JobStatus;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Poll result wrapper
|
|
144
|
+
*/
|
|
145
|
+
export interface PollResult {
|
|
146
|
+
/** Whether the job completed successfully */
|
|
147
|
+
success: boolean;
|
|
148
|
+
/** The final job response */
|
|
149
|
+
job: JobDetailsResponse;
|
|
150
|
+
/** Number of poll attempts made */
|
|
151
|
+
attempts: number;
|
|
152
|
+
/** Total time spent polling in milliseconds */
|
|
153
|
+
timeMs: number;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../../src/types/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC;;GAEG;AACH,oBAAY,SAAS;IACjB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,8FAA8F;IAC9F,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,kCAAkC;IAClC,MAAM,EAAE,IAAI,CAAC;IACb,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,+BAA+B;IAC/B,OAAO,EAAE;QACL,EAAE,EAAE,IAAI,CAAC;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,IAAI,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC,CAAC;IACF,sCAAsC;IACtC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E,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,MAAM,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,GAAG,EAAE,kBAAkB,CAAC;IACxB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1,4 +1,51 @@
|
|
|
1
|
-
import type { Character, IAgentRuntime, UUID, Memory, State, Plugin, RuntimeSettings } from './types';
|
|
1
|
+
import type { Character, IAgentRuntime, UUID, Memory, State, Plugin, RuntimeSettings, Content } from './types';
|
|
2
|
+
import type { MessageProcessingResult } from './services/message-service';
|
|
3
|
+
/**
|
|
4
|
+
* Options for sending a message to an agent
|
|
5
|
+
*/
|
|
6
|
+
export interface SendMessageOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Called when the agent generates a response (ASYNC MODE)
|
|
9
|
+
* If provided, method returns immediately (fire & forget)
|
|
10
|
+
* If not provided, method waits for response (SYNC MODE)
|
|
11
|
+
*/
|
|
12
|
+
onResponse?: (content: Content) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Called if an error occurs during processing
|
|
15
|
+
*/
|
|
16
|
+
onError?: (error: Error) => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Called when processing is complete
|
|
19
|
+
*/
|
|
20
|
+
onComplete?: () => Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum number of retries for failed messages
|
|
23
|
+
*/
|
|
24
|
+
maxRetries?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Timeout duration in milliseconds
|
|
27
|
+
*/
|
|
28
|
+
timeoutDuration?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Enable multi-step message processing
|
|
31
|
+
*/
|
|
32
|
+
useMultiStep?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum multi-step iterations
|
|
35
|
+
*/
|
|
36
|
+
maxMultiStepIterations?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Result of sending a message to an agent
|
|
40
|
+
*/
|
|
41
|
+
export interface SendMessageResult {
|
|
42
|
+
/** ID of the user message */
|
|
43
|
+
messageId: UUID;
|
|
44
|
+
/** The user message that was created */
|
|
45
|
+
userMessage: Memory;
|
|
46
|
+
/** Processing result (only in SYNC mode) */
|
|
47
|
+
result?: MessageProcessingResult;
|
|
48
|
+
}
|
|
2
49
|
/**
|
|
3
50
|
* Batch operation for sending messages
|
|
4
51
|
*/
|
|
@@ -113,29 +160,85 @@ export declare class ElizaOS extends EventTarget {
|
|
|
113
160
|
*/
|
|
114
161
|
getAgentByCharacterId(characterId: UUID): IAgentRuntime | undefined;
|
|
115
162
|
/**
|
|
116
|
-
* Send a message to a specific agent
|
|
117
|
-
*
|
|
163
|
+
* Send a message to a specific agent
|
|
164
|
+
*
|
|
165
|
+
* @param agentId - The agent ID to send the message to
|
|
166
|
+
* @param message - Partial Memory object (missing fields auto-filled)
|
|
167
|
+
* @param options - Optional callbacks and processing options
|
|
168
|
+
* @returns Promise with message ID and result
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* // SYNC mode (HTTP API)
|
|
172
|
+
* const result = await elizaOS.sendMessage(agentId, {
|
|
173
|
+
* entityId: user.id,
|
|
174
|
+
* roomId: room.id,
|
|
175
|
+
* content: { text: "Hello", source: 'web' }
|
|
176
|
+
* });
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* // ASYNC mode (WebSocket, MessageBus)
|
|
180
|
+
* await elizaOS.sendMessage(agentId, {
|
|
181
|
+
* entityId: user.id,
|
|
182
|
+
* roomId: room.id,
|
|
183
|
+
* content: { text: "Hello", source: 'websocket' }
|
|
184
|
+
* }, {
|
|
185
|
+
* onResponse: async (response) => {
|
|
186
|
+
* await socket.emit('message', response.text);
|
|
187
|
+
* }
|
|
188
|
+
* });
|
|
118
189
|
*/
|
|
119
|
-
sendMessage(agentId: UUID, message: Memory
|
|
120
|
-
|
|
121
|
-
roomId
|
|
122
|
-
|
|
123
|
-
|
|
190
|
+
sendMessage(agentId: UUID, message: Partial<Memory> & {
|
|
191
|
+
entityId: UUID;
|
|
192
|
+
roomId: UUID;
|
|
193
|
+
content: Content;
|
|
194
|
+
worldId?: UUID;
|
|
195
|
+
}, options?: SendMessageOptions): Promise<SendMessageResult>;
|
|
124
196
|
/**
|
|
125
|
-
* Send messages to multiple agents
|
|
126
|
-
*
|
|
197
|
+
* Send messages to multiple agents in parallel
|
|
198
|
+
*
|
|
199
|
+
* Useful for batch operations where you need to send messages to multiple agents at once.
|
|
200
|
+
* All messages are sent in parallel for maximum performance.
|
|
201
|
+
*
|
|
202
|
+
* @param messages - Array of messages to send, each with agentId and message data
|
|
203
|
+
* @returns Promise with array of results, one per message
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* const results = await elizaOS.sendMessages([
|
|
207
|
+
* {
|
|
208
|
+
* agentId: agent1Id,
|
|
209
|
+
* message: {
|
|
210
|
+
* entityId: user.id,
|
|
211
|
+
* roomId: room.id,
|
|
212
|
+
* content: { text: "Hello Agent 1", source: "web" }
|
|
213
|
+
* }
|
|
214
|
+
* },
|
|
215
|
+
* {
|
|
216
|
+
* agentId: agent2Id,
|
|
217
|
+
* message: {
|
|
218
|
+
* entityId: user.id,
|
|
219
|
+
* roomId: room.id,
|
|
220
|
+
* content: { text: "Hello Agent 2", source: "web" }
|
|
221
|
+
* },
|
|
222
|
+
* options: {
|
|
223
|
+
* onResponse: async (response) => {
|
|
224
|
+
* console.log("Agent 2 responded:", response.text);
|
|
225
|
+
* }
|
|
226
|
+
* }
|
|
227
|
+
* }
|
|
228
|
+
* ]);
|
|
127
229
|
*/
|
|
128
230
|
sendMessages(messages: Array<{
|
|
129
231
|
agentId: UUID;
|
|
130
|
-
message: Memory
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
232
|
+
message: Partial<Memory> & {
|
|
233
|
+
entityId: UUID;
|
|
234
|
+
roomId: UUID;
|
|
235
|
+
content: Content;
|
|
236
|
+
worldId?: UUID;
|
|
135
237
|
};
|
|
238
|
+
options?: SendMessageOptions;
|
|
136
239
|
}>): Promise<Array<{
|
|
137
240
|
agentId: UUID;
|
|
138
|
-
|
|
241
|
+
result: SendMessageResult;
|
|
139
242
|
error?: Error;
|
|
140
243
|
}>>;
|
|
141
244
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elizaos.d.ts","sourceRoot":"","sources":["../../../../core/src/elizaos.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,eAAe,
|
|
1
|
+
{"version":3,"file":"elizaos.d.ts","sourceRoot":"","sources":["../../../../core/src/elizaos.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,eAAe,EACf,OAAO,EACR,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAA4B,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KA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