@naylence/agent-sdk 0.3.11 → 0.3.13
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 +30 -0
- package/dist/browser/index.js +3268 -1913
- package/dist/browser/index.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +27 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/naylence/agent/agent-proxy.js.map +1 -1
- package/dist/cjs/naylence/agent/agent.js.map +1 -1
- package/dist/cjs/naylence/agent/background-task-agent.js.map +1 -1
- package/dist/cjs/naylence/agent/base-agent.js.map +1 -1
- package/dist/cjs/naylence/agent/configs.d.ts +12 -0
- package/dist/cjs/naylence/agent/configs.js +12 -0
- package/dist/cjs/naylence/agent/configs.js.map +1 -1
- package/dist/cjs/public-api.d.ts +7 -0
- package/dist/cjs/public-api.js +26 -0
- package/dist/cjs/public-api.js.map +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +31 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/naylence/agent/agent-proxy.d.ts +148 -0
- package/dist/esm/naylence/agent/agent-proxy.js +130 -0
- package/dist/esm/naylence/agent/agent-proxy.js.map +1 -1
- package/dist/esm/naylence/agent/agent.d.ts +194 -2
- package/dist/esm/naylence/agent/agent.js +123 -0
- package/dist/esm/naylence/agent/agent.js.map +1 -1
- package/dist/esm/naylence/agent/background-task-agent.d.ts +164 -0
- package/dist/esm/naylence/agent/background-task-agent.js +150 -0
- package/dist/esm/naylence/agent/background-task-agent.js.map +1 -1
- package/dist/esm/naylence/agent/base-agent.d.ts +171 -0
- package/dist/esm/naylence/agent/base-agent.js +170 -1
- package/dist/esm/naylence/agent/base-agent.js.map +1 -1
- package/dist/esm/naylence/agent/configs.d.ts +12 -0
- package/dist/esm/naylence/agent/configs.js +12 -0
- package/dist/esm/naylence/agent/configs.js.map +1 -1
- package/dist/esm/public-api.d.ts +15 -0
- package/dist/esm/public-api.js +16 -0
- package/dist/esm/public-api.js.map +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/naylence/agent/agent-proxy.d.ts +148 -0
- package/dist/types/naylence/agent/agent-proxy.d.ts.map +1 -1
- package/dist/types/naylence/agent/agent.d.ts +194 -2
- package/dist/types/naylence/agent/agent.d.ts.map +1 -1
- package/dist/types/naylence/agent/background-task-agent.d.ts +164 -0
- package/dist/types/naylence/agent/background-task-agent.d.ts.map +1 -1
- package/dist/types/naylence/agent/base-agent.d.ts +171 -0
- package/dist/types/naylence/agent/base-agent.d.ts.map +1 -1
- package/dist/types/naylence/agent/configs.d.ts +12 -0
- package/dist/types/naylence/agent/configs.d.ts.map +1 -1
- package/dist/types/public-api.d.ts +16 -0
- package/dist/types/public-api.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +7 -2
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent module providing the abstract {@link Agent} class.
|
|
3
|
+
*
|
|
4
|
+
* An Agent is a self-contained unit of work that can receive tasks, process them,
|
|
5
|
+
* and return results. Agents communicate over the Fame fabric using a standard
|
|
6
|
+
* task-based protocol.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* For concrete implementations:
|
|
10
|
+
* - Use {@link BaseAgent} when you need full control over task handling and state.
|
|
11
|
+
* - Use {@link BackgroundTaskAgent} for long-running or async background work.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
1
15
|
import { FameAddress, FameFabric, LogLevel } from '@naylence/runtime';
|
|
2
16
|
import { RpcMixin } from '@naylence/runtime';
|
|
3
17
|
import type { FameService } from '@naylence/core';
|
|
@@ -6,25 +20,57 @@ export { registerAgentProxyFactory } from './agent-proxy-registry.js';
|
|
|
6
20
|
export type { AgentProxyConstructor } from './agent-proxy-registry.js';
|
|
7
21
|
import type { BaseAgent } from './base-agent.js';
|
|
8
22
|
import type { AgentProxy } from './agent-proxy.js';
|
|
23
|
+
/**
|
|
24
|
+
* Payload type for agent task messages.
|
|
25
|
+
*
|
|
26
|
+
* Can be a JSON object, a string, or null.
|
|
27
|
+
*/
|
|
9
28
|
export type Payload = Record<string, unknown> | string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Collection of address-payload pairs for broadcasting tasks to multiple agents.
|
|
31
|
+
*/
|
|
10
32
|
export type Targets = Iterable<readonly [FameAddress | string, Payload]>;
|
|
33
|
+
/** @internal */
|
|
11
34
|
type AgentTaskHandler = (payload: Payload, id: string | null) => unknown | Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Constructor signature for BaseAgent implementations.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
12
39
|
export type BaseAgentConstructor = new (name?: string | null, options?: any) => BaseAgent;
|
|
13
40
|
/** @internal */
|
|
14
41
|
export declare function registerBaseAgentConstructor(ctor: BaseAgentConstructor): void;
|
|
42
|
+
/**
|
|
43
|
+
* Options for creating a remote agent proxy.
|
|
44
|
+
*
|
|
45
|
+
* Provide exactly one of `address` or `capabilities` to identify the target.
|
|
46
|
+
*/
|
|
15
47
|
export interface AgentRemoteOptions {
|
|
48
|
+
/** Direct address of the target agent. */
|
|
16
49
|
address?: FameAddress | string;
|
|
50
|
+
/** Required capabilities for capability-based discovery. */
|
|
17
51
|
capabilities?: string[];
|
|
52
|
+
/** Fabric instance to use. Defaults to the current fabric. */
|
|
18
53
|
fabric?: FameFabric;
|
|
19
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Options for running tasks on multiple agents.
|
|
57
|
+
*/
|
|
20
58
|
export interface AgentRunManyOptions {
|
|
59
|
+
/** Fabric instance to use. Defaults to the current fabric. */
|
|
21
60
|
fabric?: FameFabric;
|
|
61
|
+
/**
|
|
62
|
+
* If true (default), errors are collected alongside results.
|
|
63
|
+
* If false, the first error rejects the promise.
|
|
64
|
+
*/
|
|
22
65
|
gatherExceptions?: boolean;
|
|
23
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Options for serving an agent at a given address.
|
|
69
|
+
*/
|
|
24
70
|
export interface AgentServeOptions {
|
|
25
71
|
/**
|
|
26
|
-
* Log level for the agent.
|
|
27
|
-
*
|
|
72
|
+
* Log level for the agent.
|
|
73
|
+
* Accepts 'debug', 'info', 'warning', 'error', 'critical', or a LogLevel value.
|
|
28
74
|
*/
|
|
29
75
|
logLevel?: string | number | LogLevel | null;
|
|
30
76
|
/**
|
|
@@ -40,30 +86,176 @@ export interface AgentServeOptions {
|
|
|
40
86
|
*/
|
|
41
87
|
[key: string]: unknown;
|
|
42
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Abstract base class for all agents.
|
|
91
|
+
*
|
|
92
|
+
* Agents are addressable services that handle tasks over the Fame fabric.
|
|
93
|
+
* This class defines the core protocol methods every agent must implement.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* Do not extend Agent directly. Instead:
|
|
97
|
+
* - Extend {@link BaseAgent} for standard request-response agents.
|
|
98
|
+
* - Extend {@link BackgroundTaskAgent} for long-running background work.
|
|
99
|
+
*
|
|
100
|
+
* Use {@link Agent.remote} or {@link Agent.remoteByAddress} to create proxies
|
|
101
|
+
* for communicating with remote agents.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* import { BaseAgent, Payload } from '@naylence/agent-sdk';
|
|
106
|
+
*
|
|
107
|
+
* class EchoAgent extends BaseAgent {
|
|
108
|
+
* async runTask(payload: Payload): Promise<Payload> {
|
|
109
|
+
* return payload;
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* const agent = new EchoAgent('echo');
|
|
114
|
+
* await agent.serve('fame://echo');
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
43
117
|
export declare abstract class Agent extends RpcMixin implements FameService {
|
|
118
|
+
/**
|
|
119
|
+
* Capabilities advertised by this agent for discovery.
|
|
120
|
+
*/
|
|
44
121
|
get capabilities(): string[] | undefined;
|
|
122
|
+
/** The agent's name, used for logging and identification. */
|
|
45
123
|
abstract get name(): string | null;
|
|
124
|
+
/** Returns metadata about this agent (address, capabilities, etc.). */
|
|
46
125
|
abstract get spec(): Record<string, unknown>;
|
|
126
|
+
/** Returns the agent's card describing its capabilities and metadata. */
|
|
47
127
|
abstract getAgentCard(): Promise<AgentCard>;
|
|
128
|
+
/**
|
|
129
|
+
* Validates authentication credentials.
|
|
130
|
+
* @param credentials - The credentials to validate.
|
|
131
|
+
* @returns True if authentication succeeds.
|
|
132
|
+
*/
|
|
48
133
|
abstract authenticate(credentials: AuthenticationInfo): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Initiates a new task.
|
|
136
|
+
* @param params - Task parameters including message and optional metadata.
|
|
137
|
+
* @returns The created task with its initial status.
|
|
138
|
+
*/
|
|
49
139
|
abstract startTask(params: TaskSendParams): Promise<Task>;
|
|
140
|
+
/**
|
|
141
|
+
* Executes a task synchronously and returns the result.
|
|
142
|
+
* @param payload - The task payload.
|
|
143
|
+
* @param id - Optional task identifier.
|
|
144
|
+
* @returns The task result.
|
|
145
|
+
*/
|
|
50
146
|
abstract runTask(payload: Payload, id: string | null): Promise<any>;
|
|
147
|
+
/**
|
|
148
|
+
* Retrieves the current status of a task.
|
|
149
|
+
* @param params - Query parameters including the task ID.
|
|
150
|
+
*/
|
|
51
151
|
abstract getTaskStatus(params: TaskQueryParams): Promise<Task>;
|
|
152
|
+
/**
|
|
153
|
+
* Requests cancellation of a running task.
|
|
154
|
+
* @param params - Parameters including the task ID.
|
|
155
|
+
* @returns The task with updated status.
|
|
156
|
+
*/
|
|
52
157
|
abstract cancelTask(params: TaskIdParams): Promise<Task>;
|
|
158
|
+
/**
|
|
159
|
+
* Subscribes to real-time updates for a task.
|
|
160
|
+
* @param params - Task parameters.
|
|
161
|
+
* @returns An async iterable of status and artifact update events.
|
|
162
|
+
*/
|
|
53
163
|
abstract subscribeToTaskUpdates(params: TaskSendParams): AsyncIterable<TaskStatusUpdateEvent | TaskArtifactUpdateEvent>;
|
|
164
|
+
/**
|
|
165
|
+
* Cancels a task subscription.
|
|
166
|
+
* @param params - Parameters including the task ID.
|
|
167
|
+
*/
|
|
54
168
|
abstract unsubscribeTask(params: TaskIdParams): Promise<any>;
|
|
169
|
+
/**
|
|
170
|
+
* Registers a push notification endpoint for task updates.
|
|
171
|
+
* @param config - Push notification configuration.
|
|
172
|
+
*/
|
|
55
173
|
abstract registerPushEndpoint(config: TaskPushNotificationConfig): Promise<TaskPushNotificationConfig>;
|
|
174
|
+
/**
|
|
175
|
+
* Retrieves the push notification config for a task.
|
|
176
|
+
* @param params - Parameters including the task ID.
|
|
177
|
+
*/
|
|
56
178
|
abstract getPushNotificationConfig(params: TaskIdParams): Promise<TaskPushNotificationConfig>;
|
|
179
|
+
/**
|
|
180
|
+
* Creates a proxy for communicating with a remote agent.
|
|
181
|
+
*
|
|
182
|
+
* @remarks
|
|
183
|
+
* Provide exactly one of `address` or `capabilities` in the options.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* const proxy = Agent.remote<EchoAgent>({ address: 'fame://echo' });
|
|
188
|
+
* const result = await proxy.runTask('hello');
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @param options - Remote agent options.
|
|
192
|
+
* @returns A proxy for the remote agent.
|
|
193
|
+
* @throws Error if both or neither of address/capabilities are provided.
|
|
194
|
+
*/
|
|
57
195
|
static remote<TAgent extends Agent>(this: typeof Agent, options: AgentRemoteOptions): AgentProxy<TAgent>;
|
|
196
|
+
/**
|
|
197
|
+
* Creates a proxy for a remote agent by its address.
|
|
198
|
+
*
|
|
199
|
+
* @param address - The target agent's address.
|
|
200
|
+
* @param options - Optional fabric configuration.
|
|
201
|
+
* @returns A proxy for the remote agent.
|
|
202
|
+
*/
|
|
58
203
|
static remoteByAddress<TAgent extends Agent>(this: typeof Agent, address: FameAddress | string, options?: {
|
|
59
204
|
fabric?: FameFabric;
|
|
60
205
|
}): AgentProxy<TAgent>;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a proxy for a remote agent by required capabilities.
|
|
208
|
+
*
|
|
209
|
+
* @param capabilities - Required capabilities for discovery.
|
|
210
|
+
* @param options - Optional fabric configuration.
|
|
211
|
+
* @returns A proxy for a matching remote agent.
|
|
212
|
+
*/
|
|
61
213
|
static remoteByCapabilities<TAgent extends Agent>(this: typeof Agent, capabilities: string[], options?: {
|
|
62
214
|
fabric?: FameFabric;
|
|
63
215
|
}): AgentProxy<TAgent>;
|
|
216
|
+
/**
|
|
217
|
+
* Creates an agent from a simple handler function.
|
|
218
|
+
*
|
|
219
|
+
* @remarks
|
|
220
|
+
* Useful for quick prototyping without defining a full agent class.
|
|
221
|
+
*
|
|
222
|
+
* @param handler - Function that processes task payloads.
|
|
223
|
+
* @returns A new agent instance wrapping the handler.
|
|
224
|
+
*/
|
|
64
225
|
static fromHandler(handler: AgentTaskHandler): Promise<Agent>;
|
|
226
|
+
/**
|
|
227
|
+
* Sends the same payload to multiple agents.
|
|
228
|
+
*
|
|
229
|
+
* @param addresses - List of agent addresses.
|
|
230
|
+
* @param payload - Payload to send to all agents.
|
|
231
|
+
* @param options - Execution options.
|
|
232
|
+
* @returns Array of [address, result|error] tuples.
|
|
233
|
+
*/
|
|
65
234
|
static broadcast(this: typeof Agent, addresses: Array<FameAddress | string>, payload?: Payload, options?: AgentRunManyOptions): Promise<Array<[string, any | Error]>>;
|
|
235
|
+
/**
|
|
236
|
+
* Runs tasks on multiple agents with individual payloads.
|
|
237
|
+
*
|
|
238
|
+
* @param targets - Iterable of [address, payload] pairs.
|
|
239
|
+
* @param options - Execution options.
|
|
240
|
+
* @returns Array of [address, result|error] tuples.
|
|
241
|
+
*/
|
|
66
242
|
static runMany<TAgent extends Agent>(this: typeof Agent, targets: Targets, options?: AgentRunManyOptions): Promise<Array<[string, any | Error]>>;
|
|
243
|
+
/**
|
|
244
|
+
* Starts serving this agent at the given address.
|
|
245
|
+
*
|
|
246
|
+
* @remarks
|
|
247
|
+
* In Node.js, the agent listens for SIGINT/SIGTERM to shut down gracefully.
|
|
248
|
+
* The method returns when the agent stops serving.
|
|
249
|
+
*
|
|
250
|
+
* @param address - The address to serve at (e.g., 'fame://my-agent').
|
|
251
|
+
* @param options - Serve options including log level and fabric config.
|
|
252
|
+
*/
|
|
67
253
|
aserve(address: FameAddress | string, options?: AgentServeOptions): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Alias for {@link Agent.aserve}.
|
|
256
|
+
*
|
|
257
|
+
* @param address - The address to serve at.
|
|
258
|
+
* @param options - Serve options.
|
|
259
|
+
*/
|
|
68
260
|
serve(address: FameAddress | string, options?: AgentServeOptions): Promise<void>;
|
|
69
261
|
}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent module providing the abstract {@link Agent} class.
|
|
3
|
+
*
|
|
4
|
+
* An Agent is a self-contained unit of work that can receive tasks, process them,
|
|
5
|
+
* and return results. Agents communicate over the Fame fabric using a standard
|
|
6
|
+
* task-based protocol.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* For concrete implementations:
|
|
10
|
+
* - Use {@link BaseAgent} when you need full control over task handling and state.
|
|
11
|
+
* - Use {@link BackgroundTaskAgent} for long-running or async background work.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
1
15
|
import { FameAddress, FameFabric, basicConfig, fabricStack, generateId, getLogger, LogLevel, } from '@naylence/runtime';
|
|
2
16
|
import { RpcMixin } from '@naylence/runtime';
|
|
3
17
|
import { resolveAgentProxyCtor } from './agent-proxy-registry.js';
|
|
@@ -14,7 +28,9 @@ function requireBaseAgentCtor() {
|
|
|
14
28
|
export function registerBaseAgentConstructor(ctor) {
|
|
15
29
|
registeredBaseAgentCtor = ctor;
|
|
16
30
|
}
|
|
31
|
+
/** @internal */
|
|
17
32
|
const isNodeRuntime = () => typeof process !== 'undefined' && process.release?.name === 'node';
|
|
33
|
+
/** @internal */
|
|
18
34
|
const LOG_LEVEL_KEYWORDS = {
|
|
19
35
|
critical: LogLevel.CRITICAL,
|
|
20
36
|
error: LogLevel.ERROR,
|
|
@@ -24,6 +40,7 @@ const LOG_LEVEL_KEYWORDS = {
|
|
|
24
40
|
debug: LogLevel.DEBUG,
|
|
25
41
|
trace: LogLevel.TRACE,
|
|
26
42
|
};
|
|
43
|
+
/** @internal */
|
|
27
44
|
function normalizeLogLevel(level) {
|
|
28
45
|
if (typeof level === 'number') {
|
|
29
46
|
if (Object.values(LogLevel).includes(level)) {
|
|
@@ -41,6 +58,7 @@ function normalizeLogLevel(level) {
|
|
|
41
58
|
}
|
|
42
59
|
return level;
|
|
43
60
|
}
|
|
61
|
+
/** @internal */
|
|
44
62
|
class Deferred {
|
|
45
63
|
constructor() {
|
|
46
64
|
this.settled = false;
|
|
@@ -62,6 +80,7 @@ class Deferred {
|
|
|
62
80
|
this.internalReject(reason);
|
|
63
81
|
}
|
|
64
82
|
}
|
|
83
|
+
/** @internal */
|
|
65
84
|
async function setupSignalHandlers(stop) {
|
|
66
85
|
if (!isNodeRuntime()) {
|
|
67
86
|
return () => { };
|
|
@@ -86,6 +105,7 @@ async function setupSignalHandlers(stop) {
|
|
|
86
105
|
}
|
|
87
106
|
};
|
|
88
107
|
}
|
|
108
|
+
/** @internal */
|
|
89
109
|
async function acquireFabric(options) {
|
|
90
110
|
const manageContext = fabricStack.length === 0;
|
|
91
111
|
const fabric = await FameFabric.getOrCreate(options ?? {});
|
|
@@ -107,19 +127,68 @@ async function acquireFabric(options) {
|
|
|
107
127
|
},
|
|
108
128
|
};
|
|
109
129
|
}
|
|
130
|
+
/** @internal */
|
|
110
131
|
function toFameAddress(value) {
|
|
111
132
|
return value instanceof FameAddress ? value : new FameAddress(String(value));
|
|
112
133
|
}
|
|
134
|
+
/** @internal */
|
|
113
135
|
function invokeProxyRunTask(proxy, payload, taskId) {
|
|
114
136
|
if (typeof proxy.runTask === 'function') {
|
|
115
137
|
return proxy.runTask(payload, taskId);
|
|
116
138
|
}
|
|
117
139
|
throw new Error('AgentProxy must implement runTask');
|
|
118
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Abstract base class for all agents.
|
|
143
|
+
*
|
|
144
|
+
* Agents are addressable services that handle tasks over the Fame fabric.
|
|
145
|
+
* This class defines the core protocol methods every agent must implement.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* Do not extend Agent directly. Instead:
|
|
149
|
+
* - Extend {@link BaseAgent} for standard request-response agents.
|
|
150
|
+
* - Extend {@link BackgroundTaskAgent} for long-running background work.
|
|
151
|
+
*
|
|
152
|
+
* Use {@link Agent.remote} or {@link Agent.remoteByAddress} to create proxies
|
|
153
|
+
* for communicating with remote agents.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* import { BaseAgent, Payload } from '@naylence/agent-sdk';
|
|
158
|
+
*
|
|
159
|
+
* class EchoAgent extends BaseAgent {
|
|
160
|
+
* async runTask(payload: Payload): Promise<Payload> {
|
|
161
|
+
* return payload;
|
|
162
|
+
* }
|
|
163
|
+
* }
|
|
164
|
+
*
|
|
165
|
+
* const agent = new EchoAgent('echo');
|
|
166
|
+
* await agent.serve('fame://echo');
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
119
169
|
export class Agent extends RpcMixin {
|
|
170
|
+
/**
|
|
171
|
+
* Capabilities advertised by this agent for discovery.
|
|
172
|
+
*/
|
|
120
173
|
get capabilities() {
|
|
121
174
|
return undefined;
|
|
122
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Creates a proxy for communicating with a remote agent.
|
|
178
|
+
*
|
|
179
|
+
* @remarks
|
|
180
|
+
* Provide exactly one of `address` or `capabilities` in the options.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const proxy = Agent.remote<EchoAgent>({ address: 'fame://echo' });
|
|
185
|
+
* const result = await proxy.runTask('hello');
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @param options - Remote agent options.
|
|
189
|
+
* @returns A proxy for the remote agent.
|
|
190
|
+
* @throws Error if both or neither of address/capabilities are provided.
|
|
191
|
+
*/
|
|
123
192
|
static remote(options) {
|
|
124
193
|
const { address, capabilities, fabric } = options;
|
|
125
194
|
const selected = Number(address != null) + Number(capabilities != null);
|
|
@@ -136,6 +205,13 @@ export class Agent extends RpcMixin {
|
|
|
136
205
|
fabric: resolvedFabric,
|
|
137
206
|
});
|
|
138
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Creates a proxy for a remote agent by its address.
|
|
210
|
+
*
|
|
211
|
+
* @param address - The target agent's address.
|
|
212
|
+
* @param options - Optional fabric configuration.
|
|
213
|
+
* @returns A proxy for the remote agent.
|
|
214
|
+
*/
|
|
139
215
|
static remoteByAddress(address, options = {}) {
|
|
140
216
|
const remoteOptions = { address };
|
|
141
217
|
if (options.fabric !== undefined) {
|
|
@@ -143,6 +219,13 @@ export class Agent extends RpcMixin {
|
|
|
143
219
|
}
|
|
144
220
|
return this.remote(remoteOptions);
|
|
145
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Creates a proxy for a remote agent by required capabilities.
|
|
224
|
+
*
|
|
225
|
+
* @param capabilities - Required capabilities for discovery.
|
|
226
|
+
* @param options - Optional fabric configuration.
|
|
227
|
+
* @returns A proxy for a matching remote agent.
|
|
228
|
+
*/
|
|
146
229
|
static remoteByCapabilities(capabilities, options = {}) {
|
|
147
230
|
const remoteOptions = { capabilities };
|
|
148
231
|
if (options.fabric !== undefined) {
|
|
@@ -150,6 +233,15 @@ export class Agent extends RpcMixin {
|
|
|
150
233
|
}
|
|
151
234
|
return this.remote(remoteOptions);
|
|
152
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Creates an agent from a simple handler function.
|
|
238
|
+
*
|
|
239
|
+
* @remarks
|
|
240
|
+
* Useful for quick prototyping without defining a full agent class.
|
|
241
|
+
*
|
|
242
|
+
* @param handler - Function that processes task payloads.
|
|
243
|
+
* @returns A new agent instance wrapping the handler.
|
|
244
|
+
*/
|
|
153
245
|
static async fromHandler(handler) {
|
|
154
246
|
if (!registeredBaseAgentCtor) {
|
|
155
247
|
await import('./base-agent.js');
|
|
@@ -166,10 +258,25 @@ export class Agent extends RpcMixin {
|
|
|
166
258
|
}
|
|
167
259
|
return new HandlerAgent();
|
|
168
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Sends the same payload to multiple agents.
|
|
263
|
+
*
|
|
264
|
+
* @param addresses - List of agent addresses.
|
|
265
|
+
* @param payload - Payload to send to all agents.
|
|
266
|
+
* @param options - Execution options.
|
|
267
|
+
* @returns Array of [address, result|error] tuples.
|
|
268
|
+
*/
|
|
169
269
|
static async broadcast(addresses, payload = null, options = {}) {
|
|
170
270
|
const targets = addresses.map((address) => [address, payload]);
|
|
171
271
|
return this.runMany(targets, options);
|
|
172
272
|
}
|
|
273
|
+
/**
|
|
274
|
+
* Runs tasks on multiple agents with individual payloads.
|
|
275
|
+
*
|
|
276
|
+
* @param targets - Iterable of [address, payload] pairs.
|
|
277
|
+
* @param options - Execution options.
|
|
278
|
+
* @returns Array of [address, result|error] tuples.
|
|
279
|
+
*/
|
|
173
280
|
static async runMany(targets, options = {}) {
|
|
174
281
|
const { fabric, gatherExceptions = true } = options;
|
|
175
282
|
const resolvedFabric = fabric ?? FameFabric.current();
|
|
@@ -205,6 +312,16 @@ export class Agent extends RpcMixin {
|
|
|
205
312
|
return [addressKey, result.reason];
|
|
206
313
|
});
|
|
207
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Starts serving this agent at the given address.
|
|
317
|
+
*
|
|
318
|
+
* @remarks
|
|
319
|
+
* In Node.js, the agent listens for SIGINT/SIGTERM to shut down gracefully.
|
|
320
|
+
* The method returns when the agent stops serving.
|
|
321
|
+
*
|
|
322
|
+
* @param address - The address to serve at (e.g., 'fame://my-agent').
|
|
323
|
+
* @param options - Serve options including log level and fabric config.
|
|
324
|
+
*/
|
|
208
325
|
async aserve(address, options = {}) {
|
|
209
326
|
// Extract logLevel, pass everything else to fabric
|
|
210
327
|
const { logLevel = null, ...fabricOptions } = options;
|
|
@@ -233,6 +350,12 @@ export class Agent extends RpcMixin {
|
|
|
233
350
|
await release();
|
|
234
351
|
}
|
|
235
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Alias for {@link Agent.aserve}.
|
|
355
|
+
*
|
|
356
|
+
* @param address - The address to serve at.
|
|
357
|
+
* @param options - Serve options.
|
|
358
|
+
*/
|
|
236
359
|
serve(address, options = {}) {
|
|
237
360
|
return this.aserve(address, options);
|
|
238
361
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/naylence/agent/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAa7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAMtE,MAAM,MAAM,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../../src/naylence/agent/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAA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