agentxjs 2.6.1 → 2.8.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 +44 -1
- package/dist/chunk-JUZULVWQ.js +388 -0
- package/dist/chunk-JUZULVWQ.js.map +1 -0
- package/dist/index.d.ts +59 -289
- package/dist/index.js +124 -304
- package/dist/index.js.map +1 -1
- package/dist/server-MVOHQ5ZM.js +184 -0
- package/dist/server-MVOHQ5ZM.js.map +1 -0
- package/package.json +3 -3
- package/src/AgentHandle.ts +16 -14
- package/src/CommandHandler.ts +89 -204
- package/src/LocalClient.ts +21 -51
- package/src/RemoteClient.ts +20 -45
- package/src/index.ts +12 -26
- package/src/namespaces/agents.ts +34 -28
- package/src/namespaces/images.ts +21 -29
- package/src/namespaces/llm.ts +16 -10
- package/src/namespaces/presentations.ts +7 -7
- package/src/namespaces/sessions.ts +16 -14
- package/src/presentation/Presentation.ts +11 -11
- package/src/types.ts +64 -206
- package/dist/chunk-JTHR3AK6.js +0 -652
- package/dist/chunk-JTHR3AK6.js.map +0 -1
- package/dist/server-UCQISBKH.js +0 -7
- package/dist/server-UCQISBKH.js.map +0 -1
- package/src/namespaces/containers.ts +0 -68
- package/src/namespaces/prototypes.ts +0 -136
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
import type { Message, UserContentPart } from "@agentxjs/core/agent";
|
|
6
6
|
import type { RpcClient } from "@agentxjs/core/network";
|
|
7
7
|
import type { AgentXRuntime } from "@agentxjs/core/runtime";
|
|
8
|
-
import type {
|
|
8
|
+
import type { BaseResponse, InstanceInfo, MessageSendResponse, SessionNamespace } from "../types";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Create local session namespace backed by embedded runtime
|
|
12
12
|
*/
|
|
13
13
|
export function createLocalSessions(runtime: AgentXRuntime): SessionNamespace {
|
|
14
14
|
return {
|
|
15
|
-
async send(
|
|
16
|
-
await runtime.receive(
|
|
17
|
-
return {
|
|
15
|
+
async send(instanceId: string, content: string | unknown[]): Promise<MessageSendResponse> {
|
|
16
|
+
await runtime.receive(instanceId, content as string | UserContentPart[]);
|
|
17
|
+
return { instanceId, requestId: "" };
|
|
18
18
|
},
|
|
19
19
|
|
|
20
|
-
async interrupt(
|
|
21
|
-
runtime.interrupt(
|
|
20
|
+
async interrupt(instanceId: string): Promise<BaseResponse> {
|
|
21
|
+
runtime.interrupt(instanceId);
|
|
22
22
|
return { requestId: "" };
|
|
23
23
|
},
|
|
24
24
|
|
|
25
|
-
async getMessages(
|
|
26
|
-
const agent = runtime.getAgent(
|
|
25
|
+
async getMessages(instanceId: string): Promise<Message[]> {
|
|
26
|
+
const agent = runtime.getAgent(instanceId);
|
|
27
27
|
if (!agent) return [];
|
|
28
28
|
return runtime.platform.sessionRepository.getMessages(agent.sessionId);
|
|
29
29
|
},
|
|
@@ -35,21 +35,23 @@ export function createLocalSessions(runtime: AgentXRuntime): SessionNamespace {
|
|
|
35
35
|
*/
|
|
36
36
|
export function createRemoteSessions(rpcClient: RpcClient): SessionNamespace {
|
|
37
37
|
return {
|
|
38
|
-
async send(
|
|
38
|
+
async send(instanceId: string, content: string | unknown[]): Promise<MessageSendResponse> {
|
|
39
39
|
const result = await rpcClient.call<MessageSendResponse>("message.send", {
|
|
40
|
-
|
|
40
|
+
instanceId,
|
|
41
41
|
content,
|
|
42
42
|
});
|
|
43
43
|
return { ...result, requestId: "" };
|
|
44
44
|
},
|
|
45
45
|
|
|
46
|
-
async interrupt(
|
|
47
|
-
const result = await rpcClient.call<BaseResponse>("
|
|
46
|
+
async interrupt(instanceId: string): Promise<BaseResponse> {
|
|
47
|
+
const result = await rpcClient.call<BaseResponse>("instance.interrupt", { instanceId });
|
|
48
48
|
return { ...result, requestId: "" };
|
|
49
49
|
},
|
|
50
50
|
|
|
51
|
-
async getMessages(
|
|
52
|
-
const agentRes = await rpcClient.call<{ agent:
|
|
51
|
+
async getMessages(instanceId: string): Promise<Message[]> {
|
|
52
|
+
const agentRes = await rpcClient.call<{ agent: InstanceInfo | null }>("instance.get", {
|
|
53
|
+
instanceId,
|
|
54
|
+
});
|
|
53
55
|
if (!agentRes.agent) return [];
|
|
54
56
|
const msgRes = await rpcClient.call<{ messages: Message[] }>("image.messages", {
|
|
55
57
|
imageId: agentRes.agent.imageId,
|
|
@@ -41,7 +41,7 @@ export interface PresentationOptions {
|
|
|
41
41
|
*/
|
|
42
42
|
export class Presentation {
|
|
43
43
|
private agentx: AgentX;
|
|
44
|
-
private
|
|
44
|
+
private instanceId: string;
|
|
45
45
|
private state: PresentationState;
|
|
46
46
|
private updateHandlers: Set<PresentationUpdateHandler> = new Set();
|
|
47
47
|
private errorHandlers: Set<PresentationErrorHandler> = new Set();
|
|
@@ -49,12 +49,12 @@ export class Presentation {
|
|
|
49
49
|
|
|
50
50
|
constructor(
|
|
51
51
|
agentx: AgentX,
|
|
52
|
-
|
|
52
|
+
instanceId: string,
|
|
53
53
|
options?: PresentationOptions,
|
|
54
54
|
initialConversations?: Conversation[]
|
|
55
55
|
) {
|
|
56
56
|
this.agentx = agentx;
|
|
57
|
-
this.
|
|
57
|
+
this.instanceId = instanceId;
|
|
58
58
|
this.state = initialConversations?.length
|
|
59
59
|
? { ...initialPresentationState, conversations: initialConversations }
|
|
60
60
|
: createInitialState();
|
|
@@ -110,7 +110,7 @@ export class Presentation {
|
|
|
110
110
|
|
|
111
111
|
try {
|
|
112
112
|
// Send message via agentx
|
|
113
|
-
await this.agentx.runtime.session.send(this.
|
|
113
|
+
await this.agentx.runtime.session.send(this.instanceId, content);
|
|
114
114
|
} catch (error) {
|
|
115
115
|
this.notifyError(error instanceof Error ? error : new Error(String(error)));
|
|
116
116
|
}
|
|
@@ -121,7 +121,7 @@ export class Presentation {
|
|
|
121
121
|
*/
|
|
122
122
|
async interrupt(): Promise<void> {
|
|
123
123
|
try {
|
|
124
|
-
await this.agentx.runtime.session.interrupt(this.
|
|
124
|
+
await this.agentx.runtime.session.interrupt(this.instanceId);
|
|
125
125
|
} catch (error) {
|
|
126
126
|
this.notifyError(error instanceof Error ? error : new Error(String(error)));
|
|
127
127
|
}
|
|
@@ -150,15 +150,15 @@ export class Presentation {
|
|
|
150
150
|
// ==================== Private ====================
|
|
151
151
|
|
|
152
152
|
private subscribeToEvents(): void {
|
|
153
|
-
// Subscribe to all events and filter by
|
|
153
|
+
// Subscribe to all events and filter by instanceId
|
|
154
154
|
this.eventUnsubscribe = this.agentx.onAny((event: BusEvent) => {
|
|
155
155
|
// Filter events for this agent (if context is available)
|
|
156
|
-
// Note: Events from server may or may not include context with
|
|
157
|
-
const eventWithContext = event as BusEvent & { context?: {
|
|
158
|
-
const eventAgentId = eventWithContext.context?.
|
|
156
|
+
// Note: Events from server may or may not include context with instanceId
|
|
157
|
+
const eventWithContext = event as BusEvent & { context?: { instanceId?: string } };
|
|
158
|
+
const eventAgentId = eventWithContext.context?.instanceId;
|
|
159
159
|
|
|
160
|
-
// Only filter if event has
|
|
161
|
-
if (eventAgentId && eventAgentId !== this.
|
|
160
|
+
// Only filter if event has instanceId and it doesn't match
|
|
161
|
+
if (eventAgentId && eventAgentId !== this.instanceId) {
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
|
package/src/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type { Message } from "@agentxjs/core/agent";
|
|
6
6
|
import type { AgentXError } from "@agentxjs/core/error";
|
|
7
7
|
import type { BusEvent, BusEventHandler, EventBus, Unsubscribe } from "@agentxjs/core/event";
|
|
8
|
-
import type { LLMProtocol, LLMProviderRecord
|
|
8
|
+
import type { LLMProtocol, LLMProviderRecord } from "@agentxjs/core/persistence";
|
|
9
9
|
import type { AgentXPlatform } from "@agentxjs/core/runtime";
|
|
10
10
|
import type { Presentation, PresentationOptions } from "./presentation";
|
|
11
11
|
|
|
@@ -38,8 +38,8 @@ export interface RemoteClientConfig {
|
|
|
38
38
|
/**
|
|
39
39
|
* Agent info returned from server
|
|
40
40
|
*/
|
|
41
|
-
export interface
|
|
42
|
-
|
|
41
|
+
export interface InstanceInfo {
|
|
42
|
+
instanceId: string;
|
|
43
43
|
imageId: string;
|
|
44
44
|
containerId: string;
|
|
45
45
|
sessionId: string;
|
|
@@ -47,16 +47,28 @@ export interface AgentInfo {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* AgentConfig — flat runtime configuration for creating an agent.
|
|
51
|
+
* AgentConfig IS the body — no wrapper needed.
|
|
51
52
|
*/
|
|
52
|
-
export interface
|
|
53
|
+
export interface AgentConfig {
|
|
54
|
+
/** LLM model identifier */
|
|
53
55
|
model?: string;
|
|
56
|
+
/** System prompt for the agent */
|
|
54
57
|
systemPrompt?: string;
|
|
58
|
+
/** MCP server configurations for tool access */
|
|
55
59
|
mcpServers?: Record<string, unknown>;
|
|
60
|
+
/** Context provider ID (e.g. RoleX individual) */
|
|
61
|
+
contextId?: string;
|
|
62
|
+
/** Display name */
|
|
63
|
+
name?: string;
|
|
64
|
+
/** Description */
|
|
65
|
+
description?: string;
|
|
66
|
+
/** Arbitrary custom data */
|
|
67
|
+
customData?: Record<string, unknown>;
|
|
56
68
|
}
|
|
57
69
|
|
|
58
70
|
/**
|
|
59
|
-
* Image record from server
|
|
71
|
+
* Image record from server (internal persistence)
|
|
60
72
|
*/
|
|
61
73
|
export interface ImageRecord {
|
|
62
74
|
imageId: string;
|
|
@@ -65,23 +77,14 @@ export interface ImageRecord {
|
|
|
65
77
|
name?: string;
|
|
66
78
|
description?: string;
|
|
67
79
|
contextId?: string;
|
|
68
|
-
|
|
69
|
-
/** @deprecated Use `embody.systemPrompt` instead. */
|
|
80
|
+
model?: string;
|
|
70
81
|
systemPrompt?: string;
|
|
71
|
-
/** @deprecated Use `embody.mcpServers` instead. */
|
|
72
82
|
mcpServers?: Record<string, unknown>;
|
|
73
83
|
customData?: Record<string, unknown>;
|
|
74
84
|
createdAt: number;
|
|
75
85
|
updatedAt: number;
|
|
76
86
|
}
|
|
77
87
|
|
|
78
|
-
/**
|
|
79
|
-
* Container info
|
|
80
|
-
*/
|
|
81
|
-
export interface ContainerInfo {
|
|
82
|
-
containerId: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
88
|
// ============================================================================
|
|
86
89
|
// Request/Response Types
|
|
87
90
|
// ============================================================================
|
|
@@ -97,8 +100,8 @@ export interface BaseResponse {
|
|
|
97
100
|
/**
|
|
98
101
|
* Agent create response
|
|
99
102
|
*/
|
|
100
|
-
export interface
|
|
101
|
-
|
|
103
|
+
export interface InstanceCreateResponse extends BaseResponse {
|
|
104
|
+
instanceId: string;
|
|
102
105
|
imageId: string;
|
|
103
106
|
containerId: string;
|
|
104
107
|
sessionId: string;
|
|
@@ -107,16 +110,16 @@ export interface AgentCreateResponse extends BaseResponse {
|
|
|
107
110
|
/**
|
|
108
111
|
* Agent get response
|
|
109
112
|
*/
|
|
110
|
-
export interface
|
|
111
|
-
agent:
|
|
113
|
+
export interface InstanceGetResponse extends BaseResponse {
|
|
114
|
+
agent: InstanceInfo | null;
|
|
112
115
|
exists: boolean;
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
/**
|
|
116
119
|
* Agent list response
|
|
117
120
|
*/
|
|
118
|
-
export interface
|
|
119
|
-
agents:
|
|
121
|
+
export interface InstanceListResponse extends BaseResponse {
|
|
122
|
+
agents: InstanceInfo[];
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
/**
|
|
@@ -150,33 +153,11 @@ export interface ImageUpdateResponse extends BaseResponse {
|
|
|
150
153
|
record: ImageRecord;
|
|
151
154
|
}
|
|
152
155
|
|
|
153
|
-
/**
|
|
154
|
-
* Container create response
|
|
155
|
-
*/
|
|
156
|
-
export interface ContainerCreateResponse extends BaseResponse {
|
|
157
|
-
containerId: string;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Container get response
|
|
162
|
-
*/
|
|
163
|
-
export interface ContainerGetResponse extends BaseResponse {
|
|
164
|
-
containerId: string;
|
|
165
|
-
exists: boolean;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Container list response
|
|
170
|
-
*/
|
|
171
|
-
export interface ContainerListResponse extends BaseResponse {
|
|
172
|
-
containerIds: string[];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
156
|
/**
|
|
176
157
|
* Message send response
|
|
177
158
|
*/
|
|
178
159
|
export interface MessageSendResponse extends BaseResponse {
|
|
179
|
-
|
|
160
|
+
instanceId: string;
|
|
180
161
|
}
|
|
181
162
|
|
|
182
163
|
/**
|
|
@@ -214,62 +195,10 @@ export interface LLMProviderDefaultResponse extends BaseResponse {
|
|
|
214
195
|
record: LLMProviderRecord | null;
|
|
215
196
|
}
|
|
216
197
|
|
|
217
|
-
// ============================================================================
|
|
218
|
-
// Prototype Response Types
|
|
219
|
-
// ============================================================================
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Prototype create response
|
|
223
|
-
*/
|
|
224
|
-
export interface PrototypeCreateResponse extends BaseResponse {
|
|
225
|
-
record: PrototypeRecord;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Prototype get response
|
|
230
|
-
*/
|
|
231
|
-
export interface PrototypeGetResponse extends BaseResponse {
|
|
232
|
-
record: PrototypeRecord | null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Prototype list response
|
|
237
|
-
*/
|
|
238
|
-
export interface PrototypeListResponse extends BaseResponse {
|
|
239
|
-
records: PrototypeRecord[];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Prototype update response
|
|
244
|
-
*/
|
|
245
|
-
export interface PrototypeUpdateResponse extends BaseResponse {
|
|
246
|
-
record: PrototypeRecord;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
198
|
// ============================================================================
|
|
250
199
|
// Namespace Interfaces
|
|
251
200
|
// ============================================================================
|
|
252
201
|
|
|
253
|
-
/**
|
|
254
|
-
* Container operations namespace
|
|
255
|
-
*/
|
|
256
|
-
export interface ContainerNamespace {
|
|
257
|
-
/**
|
|
258
|
-
* Create or get container
|
|
259
|
-
*/
|
|
260
|
-
create(containerId: string): Promise<ContainerCreateResponse>;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Get container
|
|
264
|
-
*/
|
|
265
|
-
get(containerId: string): Promise<ContainerGetResponse>;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* List containers
|
|
269
|
-
*/
|
|
270
|
-
list(): Promise<ContainerListResponse>;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
202
|
/**
|
|
274
203
|
* Image operations namespace
|
|
275
204
|
*/
|
|
@@ -277,14 +206,7 @@ export interface ImageNamespace {
|
|
|
277
206
|
/**
|
|
278
207
|
* Create a new image from an Agent blueprint
|
|
279
208
|
*/
|
|
280
|
-
create(params:
|
|
281
|
-
containerId: string;
|
|
282
|
-
name?: string;
|
|
283
|
-
description?: string;
|
|
284
|
-
contextId?: string;
|
|
285
|
-
embody?: Embodiment;
|
|
286
|
-
customData?: Record<string, unknown>;
|
|
287
|
-
}): Promise<ImageCreateResponse>;
|
|
209
|
+
create(params: AgentConfig): Promise<ImageCreateResponse>;
|
|
288
210
|
|
|
289
211
|
/**
|
|
290
212
|
* Get image by ID
|
|
@@ -294,19 +216,19 @@ export interface ImageNamespace {
|
|
|
294
216
|
/**
|
|
295
217
|
* List images
|
|
296
218
|
*/
|
|
297
|
-
list(
|
|
219
|
+
list(): Promise<ImageListResponse>;
|
|
298
220
|
|
|
299
221
|
/**
|
|
300
222
|
* Update image
|
|
301
223
|
*/
|
|
302
224
|
update(
|
|
303
225
|
imageId: string,
|
|
304
|
-
updates:
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
226
|
+
updates: Partial<
|
|
227
|
+
Pick<
|
|
228
|
+
AgentConfig,
|
|
229
|
+
"name" | "description" | "model" | "systemPrompt" | "mcpServers" | "customData"
|
|
230
|
+
>
|
|
231
|
+
>
|
|
310
232
|
): Promise<ImageUpdateResponse>;
|
|
311
233
|
|
|
312
234
|
/**
|
|
@@ -323,26 +245,26 @@ export interface ImageNamespace {
|
|
|
323
245
|
/**
|
|
324
246
|
* Agent operations namespace
|
|
325
247
|
*/
|
|
326
|
-
export interface
|
|
248
|
+
export interface InstanceNamespace {
|
|
327
249
|
/**
|
|
328
250
|
* Create a new agent
|
|
329
251
|
*/
|
|
330
|
-
create(params: { imageId: string;
|
|
252
|
+
create(params: { imageId: string; instanceId?: string }): Promise<InstanceCreateResponse>;
|
|
331
253
|
|
|
332
254
|
/**
|
|
333
255
|
* Get agent by ID
|
|
334
256
|
*/
|
|
335
|
-
get(
|
|
257
|
+
get(instanceId: string): Promise<InstanceGetResponse>;
|
|
336
258
|
|
|
337
259
|
/**
|
|
338
260
|
* List agents
|
|
339
261
|
*/
|
|
340
|
-
list(
|
|
262
|
+
list(): Promise<InstanceListResponse>;
|
|
341
263
|
|
|
342
264
|
/**
|
|
343
265
|
* Destroy an agent
|
|
344
266
|
*/
|
|
345
|
-
destroy(
|
|
267
|
+
destroy(instanceId: string): Promise<BaseResponse>;
|
|
346
268
|
}
|
|
347
269
|
|
|
348
270
|
/**
|
|
@@ -352,17 +274,17 @@ export interface SessionNamespace {
|
|
|
352
274
|
/**
|
|
353
275
|
* Send message to agent
|
|
354
276
|
*/
|
|
355
|
-
send(
|
|
277
|
+
send(instanceId: string, content: string | unknown[]): Promise<MessageSendResponse>;
|
|
356
278
|
|
|
357
279
|
/**
|
|
358
280
|
* Interrupt agent
|
|
359
281
|
*/
|
|
360
|
-
interrupt(
|
|
282
|
+
interrupt(instanceId: string): Promise<BaseResponse>;
|
|
361
283
|
|
|
362
284
|
/**
|
|
363
285
|
* Get message history for an agent's session
|
|
364
286
|
*/
|
|
365
|
-
getMessages(
|
|
287
|
+
getMessages(instanceId: string): Promise<Message[]>;
|
|
366
288
|
}
|
|
367
289
|
|
|
368
290
|
/**
|
|
@@ -373,7 +295,6 @@ export interface LLMNamespace {
|
|
|
373
295
|
* Create a new LLM provider configuration
|
|
374
296
|
*/
|
|
375
297
|
create(params: {
|
|
376
|
-
containerId: string;
|
|
377
298
|
name: string;
|
|
378
299
|
vendor: string;
|
|
379
300
|
protocol: LLMProtocol;
|
|
@@ -388,9 +309,9 @@ export interface LLMNamespace {
|
|
|
388
309
|
get(id: string): Promise<LLMProviderGetResponse>;
|
|
389
310
|
|
|
390
311
|
/**
|
|
391
|
-
* List LLM providers
|
|
312
|
+
* List LLM providers
|
|
392
313
|
*/
|
|
393
|
-
list(
|
|
314
|
+
list(): Promise<LLMProviderListResponse>;
|
|
394
315
|
|
|
395
316
|
/**
|
|
396
317
|
* Update LLM provider
|
|
@@ -413,60 +334,14 @@ export interface LLMNamespace {
|
|
|
413
334
|
delete(id: string): Promise<BaseResponse>;
|
|
414
335
|
|
|
415
336
|
/**
|
|
416
|
-
* Set default LLM provider
|
|
337
|
+
* Set default LLM provider
|
|
417
338
|
*/
|
|
418
339
|
setDefault(id: string): Promise<BaseResponse>;
|
|
419
340
|
|
|
420
341
|
/**
|
|
421
|
-
* Get default LLM provider
|
|
422
|
-
*/
|
|
423
|
-
getDefault(containerId: string): Promise<LLMProviderDefaultResponse>;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Prototype operations namespace — manage reusable agent templates
|
|
428
|
-
*/
|
|
429
|
-
export interface PrototypeNamespace {
|
|
430
|
-
/**
|
|
431
|
-
* Register a new prototype
|
|
432
|
-
*/
|
|
433
|
-
create(params: {
|
|
434
|
-
containerId: string;
|
|
435
|
-
name: string;
|
|
436
|
-
description?: string;
|
|
437
|
-
contextId?: string;
|
|
438
|
-
embody?: Embodiment;
|
|
439
|
-
customData?: Record<string, unknown>;
|
|
440
|
-
}): Promise<PrototypeCreateResponse>;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Get prototype by ID
|
|
444
|
-
*/
|
|
445
|
-
get(prototypeId: string): Promise<PrototypeGetResponse>;
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* List prototypes
|
|
342
|
+
* Get default LLM provider
|
|
449
343
|
*/
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Update prototype
|
|
454
|
-
*/
|
|
455
|
-
update(
|
|
456
|
-
prototypeId: string,
|
|
457
|
-
updates: {
|
|
458
|
-
name?: string;
|
|
459
|
-
description?: string;
|
|
460
|
-
contextId?: string;
|
|
461
|
-
embody?: Embodiment;
|
|
462
|
-
customData?: Record<string, unknown>;
|
|
463
|
-
}
|
|
464
|
-
): Promise<PrototypeUpdateResponse>;
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* Delete prototype
|
|
468
|
-
*/
|
|
469
|
-
delete(prototypeId: string): Promise<BaseResponse>;
|
|
344
|
+
getDefault(): Promise<LLMProviderDefaultResponse>;
|
|
470
345
|
}
|
|
471
346
|
|
|
472
347
|
/**
|
|
@@ -478,7 +353,7 @@ export interface PresentationNamespace {
|
|
|
478
353
|
*
|
|
479
354
|
* @example
|
|
480
355
|
* ```typescript
|
|
481
|
-
* const pres = ax.present(
|
|
356
|
+
* const pres = ax.present(instanceId, {
|
|
482
357
|
* onUpdate: (state) => renderUI(state),
|
|
483
358
|
* onError: (error) => console.error(error),
|
|
484
359
|
* });
|
|
@@ -487,7 +362,7 @@ export interface PresentationNamespace {
|
|
|
487
362
|
* pres.dispose();
|
|
488
363
|
* ```
|
|
489
364
|
*/
|
|
490
|
-
create(
|
|
365
|
+
create(instanceId: string, options?: PresentationOptions): Promise<Presentation>;
|
|
491
366
|
}
|
|
492
367
|
|
|
493
368
|
// ============================================================================
|
|
@@ -498,17 +373,15 @@ export interface PresentationNamespace {
|
|
|
498
373
|
* Instance — low-level access to internal subsystems.
|
|
499
374
|
*
|
|
500
375
|
* Most users should use the top-level Agent API (ax.create, ax.send, etc.).
|
|
501
|
-
* Instance exposes the underlying image, agent, session,
|
|
376
|
+
* Instance exposes the underlying image, agent, session, llm,
|
|
502
377
|
* and presentation subsystems for advanced use cases.
|
|
503
378
|
*/
|
|
504
379
|
export interface RuntimeNamespace {
|
|
505
|
-
readonly container: ContainerNamespace;
|
|
506
380
|
readonly image: ImageNamespace;
|
|
507
|
-
readonly
|
|
381
|
+
readonly instance: InstanceNamespace;
|
|
508
382
|
readonly session: SessionNamespace;
|
|
509
383
|
readonly present: PresentationNamespace;
|
|
510
384
|
readonly llm: LLMNamespace;
|
|
511
|
-
readonly prototype: PrototypeNamespace;
|
|
512
385
|
}
|
|
513
386
|
|
|
514
387
|
// ============================================================================
|
|
@@ -523,13 +396,13 @@ export interface RuntimeNamespace {
|
|
|
523
396
|
*
|
|
524
397
|
* @example
|
|
525
398
|
* ```typescript
|
|
526
|
-
* const agent = await ax.chat.create({ name: "Aristotle",
|
|
399
|
+
* const agent = await ax.chat.create({ name: "Aristotle", model: "claude-sonnet-4-6" });
|
|
527
400
|
* await agent.send("Hello!");
|
|
528
401
|
* const messages = await agent.history();
|
|
529
402
|
* ```
|
|
530
403
|
*/
|
|
531
404
|
export interface AgentHandle {
|
|
532
|
-
readonly
|
|
405
|
+
readonly instanceId: string;
|
|
533
406
|
readonly imageId: string;
|
|
534
407
|
readonly containerId: string;
|
|
535
408
|
readonly sessionId: string;
|
|
@@ -557,12 +430,14 @@ export interface AgentHandle {
|
|
|
557
430
|
/**
|
|
558
431
|
* Update this agent's metadata
|
|
559
432
|
*/
|
|
560
|
-
update(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
433
|
+
update(
|
|
434
|
+
updates: Partial<
|
|
435
|
+
Pick<
|
|
436
|
+
AgentConfig,
|
|
437
|
+
"name" | "description" | "model" | "systemPrompt" | "mcpServers" | "customData"
|
|
438
|
+
>
|
|
439
|
+
>
|
|
440
|
+
): Promise<void>;
|
|
566
441
|
|
|
567
442
|
/**
|
|
568
443
|
* Delete this agent
|
|
@@ -583,18 +458,8 @@ export interface AgentHandle {
|
|
|
583
458
|
export interface ChatNamespace {
|
|
584
459
|
/**
|
|
585
460
|
* Create a new conversation
|
|
586
|
-
*
|
|
587
|
-
* When `prototypeId` is provided, the conversation inherits the prototype's
|
|
588
|
-
* configuration (contextId, embody, etc.). Inline params override prototype values.
|
|
589
461
|
*/
|
|
590
|
-
create(params:
|
|
591
|
-
prototypeId?: string;
|
|
592
|
-
name?: string;
|
|
593
|
-
description?: string;
|
|
594
|
-
contextId?: string;
|
|
595
|
-
embody?: Embodiment;
|
|
596
|
-
customData?: Record<string, unknown>;
|
|
597
|
-
}): Promise<AgentHandle>;
|
|
462
|
+
create(params: AgentConfig): Promise<AgentHandle>;
|
|
598
463
|
|
|
599
464
|
/**
|
|
600
465
|
* List all conversations
|
|
@@ -617,7 +482,7 @@ export interface ChatNamespace {
|
|
|
617
482
|
* @example
|
|
618
483
|
* ```typescript
|
|
619
484
|
* const ax = createAgentX(config);
|
|
620
|
-
* const agent = await ax.chat.create({ name: "Aristotle",
|
|
485
|
+
* const agent = await ax.chat.create({ name: "Aristotle", model: "claude-sonnet-4-6" });
|
|
621
486
|
* await agent.send("Hello!");
|
|
622
487
|
* ```
|
|
623
488
|
*
|
|
@@ -641,17 +506,10 @@ export interface AgentX {
|
|
|
641
506
|
*/
|
|
642
507
|
readonly chat: ChatNamespace;
|
|
643
508
|
|
|
644
|
-
// ==================== Prototype (templates) ====================
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* Prototype management — register and manage reusable agent templates.
|
|
648
|
-
*/
|
|
649
|
-
readonly prototype: PrototypeNamespace;
|
|
650
|
-
|
|
651
509
|
// ==================== Instance (low-level) ====================
|
|
652
510
|
|
|
653
511
|
/**
|
|
654
|
-
* Low-level access to internal subsystems (image, agent, session,
|
|
512
|
+
* Low-level access to internal subsystems (image, agent, session, llm).
|
|
655
513
|
*/
|
|
656
514
|
readonly runtime: RuntimeNamespace;
|
|
657
515
|
|