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.
@@ -12,20 +12,12 @@ import type { AgentXRuntime } from "@agentxjs/core/runtime";
12
12
  import { createLogger } from "commonxjs/logger";
13
13
  import { AgentHandleImpl } from "./AgentHandle";
14
14
  import { CommandHandler } from "./CommandHandler";
15
- import { createLocalAgents } from "./namespaces/agents";
16
- import { createLocalContainers } from "./namespaces/containers";
15
+ import { createLocalInstances } from "./namespaces/agents";
17
16
  import { createLocalImages } from "./namespaces/images";
18
17
  import { createLocalLLM } from "./namespaces/llm";
19
18
  import { createPresentations } from "./namespaces/presentations";
20
- import { createLocalPrototypes } from "./namespaces/prototypes";
21
19
  import { createLocalSessions } from "./namespaces/sessions";
22
- import type {
23
- AgentX,
24
- ChatNamespace,
25
- LLMNamespace,
26
- PrototypeNamespace,
27
- RuntimeNamespace,
28
- } from "./types";
20
+ import type { AgentX, ChatNamespace, LLMNamespace, RuntimeNamespace } from "./types";
29
21
 
30
22
  const logger = createLogger("agentx/LocalClient");
31
23
 
@@ -40,23 +32,19 @@ export class LocalClient implements AgentX {
40
32
  readonly chat: ChatNamespace;
41
33
  readonly runtime: RuntimeNamespace;
42
34
  readonly provider: LLMNamespace;
43
- readonly prototype: PrototypeNamespace;
44
35
 
45
36
  constructor(agentxRuntime: AgentXRuntime) {
46
37
  this._runtime = agentxRuntime;
47
38
  const platform = agentxRuntime.platform;
48
39
 
49
- const container = createLocalContainers(platform);
50
40
  const image = createLocalImages(platform);
51
- const agent = createLocalAgents(agentxRuntime);
41
+ const instance = createLocalInstances(agentxRuntime);
52
42
  const session = createLocalSessions(agentxRuntime);
53
43
  const llm = createLocalLLM(platform);
54
- const prototype = createLocalPrototypes(platform);
55
- const present = createPresentations(this, image);
44
+ const present = createPresentations(this, session);
56
45
 
57
- this.runtime = { container, image, agent, session, present, llm, prototype };
46
+ this.runtime = { image, instance, session, present, llm };
58
47
  this.provider = llm;
59
- this.prototype = prototype;
60
48
  this.chat = this.createChatNamespace();
61
49
 
62
50
  logger.info("LocalClient initialized");
@@ -110,55 +98,37 @@ export class LocalClient implements AgentX {
110
98
  // ==================== Private ====================
111
99
 
112
100
  private createChatNamespace(): ChatNamespace {
113
- const instance = this.runtime;
101
+ const rt = this.runtime;
114
102
  return {
115
103
  async create(params) {
116
- const containerId = "default";
117
- // If prototypeId is provided, merge prototype config into params
118
- let mergedParams = { ...params };
119
- if (params.prototypeId) {
120
- const protoRes = await instance.prototype.get(params.prototypeId);
121
- if (protoRes.record) {
122
- const proto = protoRes.record;
123
- mergedParams = {
124
- name: proto.name,
125
- description: proto.description,
126
- contextId: proto.contextId,
127
- embody: proto.embody,
128
- customData: proto.customData,
129
- ...params, // inline params override prototype
130
- };
131
- }
132
- }
133
- const { prototypeId: _pid, ...imageParams } = mergedParams;
134
- const imgRes = await instance.image.create({ containerId, ...imageParams });
135
- const agentRes = await instance.agent.create({ imageId: imgRes.record.imageId });
104
+ const imgRes = await rt.image.create(params);
105
+ const instRes = await rt.instance.create({ imageId: imgRes.record.imageId });
136
106
  return new AgentHandleImpl(
137
107
  {
138
- agentId: agentRes.agentId,
139
- imageId: agentRes.imageId,
140
- containerId: agentRes.containerId,
141
- sessionId: agentRes.sessionId,
108
+ instanceId: instRes.instanceId,
109
+ imageId: instRes.imageId,
110
+ containerId: instRes.containerId,
111
+ sessionId: instRes.sessionId,
142
112
  },
143
- instance
113
+ rt
144
114
  );
145
115
  },
146
116
  async list() {
147
- return instance.image.list();
117
+ return rt.image.list();
148
118
  },
149
119
  async get(id) {
150
- const res = await instance.image.get(id);
120
+ const res = await rt.image.get(id);
151
121
  if (!res.record) return null;
152
122
  const r = res.record;
153
- const agentRes = await instance.agent.create({ imageId: r.imageId });
123
+ const instRes = await rt.instance.create({ imageId: r.imageId });
154
124
  return new AgentHandleImpl(
155
125
  {
156
- agentId: agentRes.agentId,
157
- imageId: agentRes.imageId,
158
- containerId: agentRes.containerId,
159
- sessionId: agentRes.sessionId,
126
+ instanceId: instRes.instanceId,
127
+ imageId: instRes.imageId,
128
+ containerId: instRes.containerId,
129
+ sessionId: instRes.sessionId,
160
130
  },
161
- instance
131
+ rt
162
132
  );
163
133
  },
164
134
  };
@@ -11,18 +11,15 @@ import { EventBusImpl } from "@agentxjs/core/event";
11
11
  import { RpcClient, type RpcMethod } from "@agentxjs/core/network";
12
12
  import { createLogger } from "commonxjs/logger";
13
13
  import { AgentHandleImpl } from "./AgentHandle";
14
- import { createRemoteAgents } from "./namespaces/agents";
15
- import { createRemoteContainers } from "./namespaces/containers";
14
+ import { createRemoteInstances } from "./namespaces/agents";
16
15
  import { createRemoteImages } from "./namespaces/images";
17
16
  import { createRemoteLLM } from "./namespaces/llm";
18
17
  import { createPresentations } from "./namespaces/presentations";
19
- import { createRemotePrototypes } from "./namespaces/prototypes";
20
18
  import { createRemoteSessions } from "./namespaces/sessions";
21
19
  import type {
22
20
  AgentX,
23
21
  ChatNamespace,
24
22
  LLMNamespace,
25
- PrototypeNamespace,
26
23
  RemoteClientConfig,
27
24
  RuntimeNamespace,
28
25
  } from "./types";
@@ -40,7 +37,6 @@ export class RemoteClient implements AgentX {
40
37
  readonly chat: ChatNamespace;
41
38
  readonly runtime: RuntimeNamespace;
42
39
  readonly provider: LLMNamespace;
43
- readonly prototype: PrototypeNamespace;
44
40
 
45
41
  constructor(config: RemoteClientConfig) {
46
42
  this.config = config;
@@ -63,17 +59,14 @@ export class RemoteClient implements AgentX {
63
59
  });
64
60
 
65
61
  // Assemble namespaces
66
- const container = createRemoteContainers(this.rpcClient);
67
62
  const image = createRemoteImages(this.rpcClient, (sessionId) => this.subscribe(sessionId));
68
- const agent = createRemoteAgents(this.rpcClient);
63
+ const instance = createRemoteInstances(this.rpcClient);
69
64
  const session = createRemoteSessions(this.rpcClient);
70
65
  const llm = createRemoteLLM(this.rpcClient);
71
- const prototype = createRemotePrototypes(this.rpcClient);
72
- const present = createPresentations(this, image);
66
+ const present = createPresentations(this, session);
73
67
 
74
- this.runtime = { container, image, agent, session, present, llm, prototype };
68
+ this.runtime = { image, instance, session, present, llm };
75
69
  this.provider = llm;
76
- this.prototype = prototype;
77
70
  this.chat = this.createChatNamespace();
78
71
  }
79
72
 
@@ -137,55 +130,37 @@ export class RemoteClient implements AgentX {
137
130
  // ==================== Private ====================
138
131
 
139
132
  private createChatNamespace(): ChatNamespace {
140
- const instance = this.runtime;
133
+ const rt = this.runtime;
141
134
  return {
142
135
  async create(params) {
143
- const containerId = "default";
144
- // If prototypeId is provided, merge prototype config into params
145
- let mergedParams = { ...params };
146
- if (params.prototypeId) {
147
- const protoRes = await instance.prototype.get(params.prototypeId);
148
- if (protoRes.record) {
149
- const proto = protoRes.record;
150
- mergedParams = {
151
- name: proto.name,
152
- description: proto.description,
153
- contextId: proto.contextId,
154
- embody: proto.embody,
155
- customData: proto.customData,
156
- ...params, // inline params override prototype
157
- };
158
- }
159
- }
160
- const { prototypeId: _pid, ...imageParams } = mergedParams;
161
- const imgRes = await instance.image.create({ containerId, ...imageParams });
162
- const agentRes = await instance.agent.create({ imageId: imgRes.record.imageId });
136
+ const imgRes = await rt.image.create(params);
137
+ const instRes = await rt.instance.create({ imageId: imgRes.record.imageId });
163
138
  return new AgentHandleImpl(
164
139
  {
165
- agentId: agentRes.agentId,
166
- imageId: agentRes.imageId,
167
- containerId: agentRes.containerId,
168
- sessionId: agentRes.sessionId,
140
+ instanceId: instRes.instanceId,
141
+ imageId: instRes.imageId,
142
+ containerId: instRes.containerId,
143
+ sessionId: instRes.sessionId,
169
144
  },
170
- instance
145
+ rt
171
146
  );
172
147
  },
173
148
  async list() {
174
- return instance.image.list();
149
+ return rt.image.list();
175
150
  },
176
151
  async get(id) {
177
- const res = await instance.image.get(id);
152
+ const res = await rt.image.get(id);
178
153
  if (!res.record) return null;
179
154
  const r = res.record;
180
- const agentRes = await instance.agent.create({ imageId: r.imageId });
155
+ const instRes = await rt.instance.create({ imageId: r.imageId });
181
156
  return new AgentHandleImpl(
182
157
  {
183
- agentId: agentRes.agentId,
184
- imageId: agentRes.imageId,
185
- containerId: agentRes.containerId,
186
- sessionId: agentRes.sessionId,
158
+ instanceId: instRes.instanceId,
159
+ imageId: instRes.imageId,
160
+ containerId: instRes.containerId,
161
+ sessionId: instRes.sessionId,
187
162
  },
188
- instance
163
+ rt
189
164
  );
190
165
  },
191
166
  };
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * import { nodePlatform } from "@agentxjs/node-platform";
10
10
  *
11
11
  * const ax = createAgentX(nodePlatform({ createDriver }));
12
- * const agent = await ax.chat.create({ name: "Aristotle", embody: { model: "claude-sonnet-4-6" } });
12
+ * const agent = await ax.chat.create({ name: "Aristotle", model: "claude-sonnet-4-6" });
13
13
  * await agent.send("Hello!");
14
14
  * ```
15
15
  *
@@ -87,10 +87,6 @@ export function createAgentX(config?: PlatformConfig): AgentXBuilder {
87
87
  return getLocalClient().chat;
88
88
  },
89
89
 
90
- get prototype() {
91
- return getLocalClient().prototype;
92
- },
93
-
94
90
  on(type, handler) {
95
91
  return getLocalClient().on(type, handler);
96
92
  },
@@ -156,12 +152,12 @@ export function createAgentX(config?: PlatformConfig): AgentXBuilder {
156
152
  };
157
153
  }
158
154
 
159
- export type { AgentXErrorCategory, AgentXErrorContext } from "@agentxjs/core/error";
155
+ // Re-export context interfaces
156
+ export type { Capability, Context, ContextProvider } from "@agentxjs/core/context";
160
157
  // Re-export error types
158
+ export type { AgentXErrorCategory, AgentXErrorContext } from "@agentxjs/core/error";
161
159
  export { AgentXError, AgentXErrorCode } from "@agentxjs/core/error";
162
- // Re-export server
163
- export { CommandHandler } from "./CommandHandler";
164
- // Re-export Presentation types and classes
160
+ // Re-export Presentation
165
161
  export type {
166
162
  AssistantConversation,
167
163
  Block,
@@ -184,32 +180,27 @@ export {
184
180
  Presentation,
185
181
  presentationReducer,
186
182
  } from "./presentation";
187
- export { createServer, type ServerConfig } from "./server";
188
183
  // Re-export types
189
184
  export type {
190
- AgentCreateResponse,
191
- AgentGetResponse,
185
+ AgentConfig,
192
186
  AgentHandle,
193
- AgentInfo,
194
- AgentListResponse,
195
- AgentNamespace,
196
187
  AgentX,
197
188
  AgentXBuilder,
198
189
  AgentXServer,
199
190
  BaseResponse,
200
191
  ChatNamespace,
201
192
  ConnectOptions,
202
- ContainerCreateResponse,
203
- ContainerGetResponse,
204
- ContainerInfo,
205
- ContainerListResponse,
206
- ContainerNamespace,
207
- Embodiment,
208
193
  ImageCreateResponse,
209
194
  ImageGetResponse,
210
195
  ImageListResponse,
211
196
  ImageNamespace,
212
197
  ImageRecord,
198
+ ImageUpdateResponse,
199
+ InstanceCreateResponse,
200
+ InstanceGetResponse,
201
+ InstanceInfo,
202
+ InstanceListResponse,
203
+ InstanceNamespace,
213
204
  LLMNamespace,
214
205
  LLMProviderCreateResponse,
215
206
  LLMProviderDefaultResponse,
@@ -219,11 +210,6 @@ export type {
219
210
  MaybeAsync,
220
211
  MessageSendResponse,
221
212
  PresentationNamespace,
222
- PrototypeCreateResponse,
223
- PrototypeGetResponse,
224
- PrototypeListResponse,
225
- PrototypeNamespace,
226
- PrototypeUpdateResponse,
227
213
  RuntimeNamespace,
228
214
  ServeConfig,
229
215
  SessionNamespace,
@@ -5,19 +5,22 @@
5
5
  import type { RpcClient, RpcMethod } from "@agentxjs/core/network";
6
6
  import type { AgentXRuntime } from "@agentxjs/core/runtime";
7
7
  import type {
8
- AgentCreateResponse,
9
- AgentGetResponse,
10
- AgentListResponse,
11
- AgentNamespace,
12
8
  BaseResponse,
9
+ InstanceCreateResponse,
10
+ InstanceGetResponse,
11
+ InstanceListResponse,
12
+ InstanceNamespace,
13
13
  } from "../types";
14
14
 
15
15
  /**
16
16
  * Create local agent namespace backed by embedded runtime
17
17
  */
18
- export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
18
+ export function createLocalInstances(runtime: AgentXRuntime): InstanceNamespace {
19
19
  return {
20
- async create(params: { imageId: string; agentId?: string }): Promise<AgentCreateResponse> {
20
+ async create(params: {
21
+ imageId: string;
22
+ instanceId?: string;
23
+ }): Promise<InstanceCreateResponse> {
21
24
  // Reuse existing running agent for this image
22
25
  const existingAgent = runtime
23
26
  .getAgents()
@@ -25,7 +28,7 @@ export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
25
28
 
26
29
  if (existingAgent) {
27
30
  return {
28
- agentId: existingAgent.agentId,
31
+ instanceId: existingAgent.instanceId,
29
32
  imageId: existingAgent.imageId,
30
33
  containerId: existingAgent.containerId,
31
34
  sessionId: existingAgent.sessionId,
@@ -35,11 +38,11 @@ export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
35
38
 
36
39
  const agent = await runtime.createAgent({
37
40
  imageId: params.imageId,
38
- agentId: params.agentId,
41
+ instanceId: params.instanceId,
39
42
  });
40
43
 
41
44
  return {
42
- agentId: agent.agentId,
45
+ instanceId: agent.instanceId,
43
46
  imageId: agent.imageId,
44
47
  containerId: agent.containerId,
45
48
  sessionId: agent.sessionId,
@@ -47,12 +50,12 @@ export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
47
50
  };
48
51
  },
49
52
 
50
- async get(agentId: string): Promise<AgentGetResponse> {
51
- const agent = runtime.getAgent(agentId);
53
+ async get(instanceId: string): Promise<InstanceGetResponse> {
54
+ const agent = runtime.getAgent(instanceId);
52
55
  return {
53
56
  agent: agent
54
57
  ? {
55
- agentId: agent.agentId,
58
+ instanceId: agent.instanceId,
56
59
  imageId: agent.imageId,
57
60
  containerId: agent.containerId,
58
61
  sessionId: agent.sessionId,
@@ -64,12 +67,12 @@ export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
64
67
  };
65
68
  },
66
69
 
67
- async list(containerId?: string): Promise<AgentListResponse> {
68
- const agents = containerId ? runtime.getAgentsByContainer(containerId) : runtime.getAgents();
70
+ async list(): Promise<InstanceListResponse> {
71
+ const agents = runtime.getAgents();
69
72
 
70
73
  return {
71
74
  agents: agents.map((a) => ({
72
- agentId: a.agentId,
75
+ instanceId: a.instanceId,
73
76
  imageId: a.imageId,
74
77
  containerId: a.containerId,
75
78
  sessionId: a.sessionId,
@@ -79,10 +82,10 @@ export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
79
82
  };
80
83
  },
81
84
 
82
- async destroy(agentId: string): Promise<BaseResponse> {
83
- const agent = runtime.getAgent(agentId);
85
+ async destroy(instanceId: string): Promise<BaseResponse> {
86
+ const agent = runtime.getAgent(instanceId);
84
87
  if (agent) {
85
- await runtime.destroyAgent(agentId);
88
+ await runtime.destroyAgent(instanceId);
86
89
  }
87
90
  return { requestId: "" };
88
91
  },
@@ -92,29 +95,32 @@ export function createLocalAgents(runtime: AgentXRuntime): AgentNamespace {
92
95
  /**
93
96
  * Create remote agent namespace backed by RPC client
94
97
  */
95
- export function createRemoteAgents(rpcClient: RpcClient): AgentNamespace {
98
+ export function createRemoteInstances(rpcClient: RpcClient): InstanceNamespace {
96
99
  return {
97
- async create(params: { imageId: string; agentId?: string }): Promise<AgentCreateResponse> {
100
+ async create(params: {
101
+ imageId: string;
102
+ instanceId?: string;
103
+ }): Promise<InstanceCreateResponse> {
98
104
  // Agent creation via image.run RPC
99
- const result = await rpcClient.call<AgentCreateResponse>("image.run" as RpcMethod, {
105
+ const result = await rpcClient.call<InstanceCreateResponse>("image.run" as RpcMethod, {
100
106
  imageId: params.imageId,
101
- agentId: params.agentId,
107
+ instanceId: params.instanceId,
102
108
  });
103
109
  return { ...result, requestId: "" };
104
110
  },
105
111
 
106
- async get(agentId: string): Promise<AgentGetResponse> {
107
- const result = await rpcClient.call<AgentGetResponse>("agent.get", { agentId });
112
+ async get(instanceId: string): Promise<InstanceGetResponse> {
113
+ const result = await rpcClient.call<InstanceGetResponse>("instance.get", { instanceId });
108
114
  return { ...result, requestId: "" };
109
115
  },
110
116
 
111
- async list(containerId?: string): Promise<AgentListResponse> {
112
- const result = await rpcClient.call<AgentListResponse>("agent.list", { containerId });
117
+ async list(): Promise<InstanceListResponse> {
118
+ const result = await rpcClient.call<InstanceListResponse>("instance.list", {});
113
119
  return { ...result, requestId: "" };
114
120
  },
115
121
 
116
- async destroy(agentId: string): Promise<BaseResponse> {
117
- const result = await rpcClient.call<BaseResponse>("agent.destroy", { agentId });
122
+ async destroy(instanceId: string): Promise<BaseResponse> {
123
+ const result = await rpcClient.call<BaseResponse>("instance.destroy", { instanceId });
118
124
  return { ...result, requestId: "" };
119
125
  },
120
126
  };
@@ -3,9 +3,11 @@
3
3
  */
4
4
 
5
5
  import type { Message } from "@agentxjs/core/agent";
6
+ import { DEFAULT_CONTAINER_ID } from "@agentxjs/core/container";
6
7
  import type { RpcClient } from "@agentxjs/core/network";
7
8
  import type { AgentXPlatform } from "@agentxjs/core/runtime";
8
9
  import type {
10
+ AgentConfig,
9
11
  BaseResponse,
10
12
  ImageCreateResponse,
11
13
  ImageGetResponse,
@@ -19,25 +21,21 @@ import type {
19
21
  */
20
22
  export function createLocalImages(platform: AgentXPlatform): ImageNamespace {
21
23
  return {
22
- async create(params: {
23
- containerId: string;
24
- name?: string;
25
- description?: string;
26
- systemPrompt?: string;
27
- mcpServers?: Record<string, unknown>;
28
- customData?: Record<string, unknown>;
29
- }): Promise<ImageCreateResponse> {
24
+ async create(params: AgentConfig): Promise<ImageCreateResponse> {
30
25
  const { imageRepository, sessionRepository } = platform;
31
26
  const { createImage } = await import("@agentxjs/core/image");
32
27
 
28
+ const { model, systemPrompt, mcpServers, ...rest } = params;
29
+ const embody =
30
+ model || systemPrompt || mcpServers
31
+ ? { model, systemPrompt, mcpServers: mcpServers as any }
32
+ : undefined;
33
+
33
34
  const image = await createImage(
34
35
  {
35
- containerId: params.containerId,
36
- name: params.name,
37
- description: params.description,
38
- systemPrompt: params.systemPrompt,
39
- mcpServers: params.mcpServers as any,
40
- customData: params.customData,
36
+ containerId: DEFAULT_CONTAINER_ID,
37
+ ...rest,
38
+ embody,
41
39
  },
42
40
  { imageRepository, sessionRepository }
43
41
  );
@@ -58,10 +56,8 @@ export function createLocalImages(platform: AgentXPlatform): ImageNamespace {
58
56
  };
59
57
  },
60
58
 
61
- async list(containerId?: string): Promise<ImageListResponse> {
62
- const records = containerId
63
- ? await platform.imageRepository.findImagesByContainerId(containerId)
64
- : await platform.imageRepository.findAllImages();
59
+ async list(): Promise<ImageListResponse> {
60
+ const records = await platform.imageRepository.findAllImages();
65
61
 
66
62
  return {
67
63
  records,
@@ -118,15 +114,11 @@ export function createRemoteImages(
118
114
  subscribeFn: (sessionId: string) => void
119
115
  ): ImageNamespace {
120
116
  return {
121
- async create(params: {
122
- containerId: string;
123
- name?: string;
124
- description?: string;
125
- systemPrompt?: string;
126
- mcpServers?: Record<string, unknown>;
127
- customData?: Record<string, unknown>;
128
- }): Promise<ImageCreateResponse> {
129
- const result = await rpcClient.call<ImageCreateResponse>("image.create", params);
117
+ async create(params: AgentConfig): Promise<ImageCreateResponse> {
118
+ const result = await rpcClient.call<ImageCreateResponse>("image.create", {
119
+ ...params,
120
+ containerId: DEFAULT_CONTAINER_ID,
121
+ });
130
122
 
131
123
  // Auto subscribe to session events
132
124
  if (result.__subscriptions) {
@@ -151,8 +143,8 @@ export function createRemoteImages(
151
143
  return { ...result, requestId: "" };
152
144
  },
153
145
 
154
- async list(containerId?: string): Promise<ImageListResponse> {
155
- const result = await rpcClient.call<ImageListResponse>("image.list", { containerId });
146
+ async list(): Promise<ImageListResponse> {
147
+ const result = await rpcClient.call<ImageListResponse>("image.list", {});
156
148
 
157
149
  // Auto subscribe
158
150
  if (result.__subscriptions) {
@@ -2,6 +2,7 @@
2
2
  * LLM Provider namespace factories
3
3
  */
4
4
 
5
+ import { DEFAULT_CONTAINER_ID } from "@agentxjs/core/container";
5
6
  import type { RpcClient } from "@agentxjs/core/network";
6
7
  import type { LLMProviderRecord } from "@agentxjs/core/persistence";
7
8
  import type { AgentXPlatform } from "@agentxjs/core/runtime";
@@ -30,7 +31,7 @@ export function createLocalLLM(platform: AgentXPlatform): LLMNamespace {
30
31
  const now = Date.now();
31
32
  const record: LLMProviderRecord = {
32
33
  id: generateId("llm"),
33
- containerId: params.containerId,
34
+ containerId: DEFAULT_CONTAINER_ID,
34
35
  name: params.name,
35
36
  vendor: params.vendor,
36
37
  protocol: params.protocol,
@@ -51,8 +52,8 @@ export function createLocalLLM(platform: AgentXPlatform): LLMNamespace {
51
52
  return { record, requestId: "" };
52
53
  },
53
54
 
54
- async list(containerId: string): Promise<LLMProviderListResponse> {
55
- const records = await repo.findLLMProvidersByContainerId(containerId);
55
+ async list(): Promise<LLMProviderListResponse> {
56
+ const records = await repo.findLLMProvidersByContainerId(DEFAULT_CONTAINER_ID);
56
57
  return { records, requestId: "" };
57
58
  },
58
59
 
@@ -85,8 +86,8 @@ export function createLocalLLM(platform: AgentXPlatform): LLMNamespace {
85
86
  return { requestId: "" };
86
87
  },
87
88
 
88
- async getDefault(containerId: string): Promise<LLMProviderDefaultResponse> {
89
- const record = await repo.findDefaultLLMProvider(containerId);
89
+ async getDefault(): Promise<LLMProviderDefaultResponse> {
90
+ const record = await repo.findDefaultLLMProvider(DEFAULT_CONTAINER_ID);
90
91
  return { record, requestId: "" };
91
92
  },
92
93
  };
@@ -98,7 +99,10 @@ export function createLocalLLM(platform: AgentXPlatform): LLMNamespace {
98
99
  export function createRemoteLLM(rpcClient: RpcClient): LLMNamespace {
99
100
  return {
100
101
  async create(params): Promise<LLMProviderCreateResponse> {
101
- const result = await rpcClient.call<LLMProviderCreateResponse>("llm.create", params);
102
+ const result = await rpcClient.call<LLMProviderCreateResponse>("llm.create", {
103
+ ...params,
104
+ containerId: DEFAULT_CONTAINER_ID,
105
+ });
102
106
  return { ...result, requestId: "" };
103
107
  },
104
108
 
@@ -107,8 +111,10 @@ export function createRemoteLLM(rpcClient: RpcClient): LLMNamespace {
107
111
  return { ...result, requestId: "" };
108
112
  },
109
113
 
110
- async list(containerId: string): Promise<LLMProviderListResponse> {
111
- const result = await rpcClient.call<LLMProviderListResponse>("llm.list", { containerId });
114
+ async list(): Promise<LLMProviderListResponse> {
115
+ const result = await rpcClient.call<LLMProviderListResponse>("llm.list", {
116
+ containerId: DEFAULT_CONTAINER_ID,
117
+ });
112
118
  return { ...result, requestId: "" };
113
119
  },
114
120
 
@@ -130,9 +136,9 @@ export function createRemoteLLM(rpcClient: RpcClient): LLMNamespace {
130
136
  return { ...result, requestId: "" };
131
137
  },
132
138
 
133
- async getDefault(containerId: string): Promise<LLMProviderDefaultResponse> {
139
+ async getDefault(): Promise<LLMProviderDefaultResponse> {
134
140
  const result = await rpcClient.call<LLMProviderDefaultResponse>("llm.default", {
135
- containerId,
141
+ containerId: DEFAULT_CONTAINER_ID,
136
142
  });
137
143
  return { ...result, requestId: "" };
138
144
  },
@@ -5,23 +5,23 @@
5
5
  */
6
6
 
7
7
  import { messagesToConversations, Presentation, type PresentationOptions } from "../presentation";
8
- import type { AgentX, ImageNamespace, PresentationNamespace } from "../types";
8
+ import type { AgentX, PresentationNamespace, SessionNamespace } from "../types";
9
9
 
10
10
  /**
11
11
  * Create presentation namespace.
12
12
  *
13
- * Takes the full AgentX (for Presentation event wiring) and the ImageNamespace
14
- * (for message history), avoiding circular access to `instance` during construction.
13
+ * Takes the full AgentX (for Presentation event wiring) and the SessionNamespace
14
+ * (for message history via instanceId).
15
15
  */
16
16
  export function createPresentations(
17
17
  agentx: AgentX,
18
- imageNs: ImageNamespace
18
+ sessionNs: SessionNamespace
19
19
  ): PresentationNamespace {
20
20
  return {
21
- async create(agentId: string, options?: PresentationOptions): Promise<Presentation> {
22
- const messages = await imageNs.getMessages(agentId);
21
+ async create(instanceId: string, options?: PresentationOptions): Promise<Presentation> {
22
+ const messages = await sessionNs.getMessages(instanceId);
23
23
  const conversations = messagesToConversations(messages);
24
- return new Presentation(agentx, agentId, options, conversations);
24
+ return new Presentation(agentx, instanceId, options, conversations);
25
25
  },
26
26
  };
27
27
  }