@meshagent/meshagent-agents 0.43.2 → 0.43.3
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/CHANGELOG.md +3 -0
- package/dist/browser/agent-messages.d.ts +1 -0
- package/dist/browser/agent-messages.js +11 -6
- package/dist/browser/chat-client.d.ts +33 -9
- package/dist/browser/chat-client.js +416 -84
- package/dist/esm/agent-messages.d.ts +1 -0
- package/dist/esm/agent-messages.js +11 -6
- package/dist/esm/chat-client.d.ts +33 -9
- package/dist/esm/chat-client.js +418 -86
- package/dist/node/agent-messages.d.ts +1 -0
- package/dist/node/agent-messages.js +11 -6
- package/dist/node/chat-client.d.ts +33 -9
- package/dist/node/chat-client.js +416 -84
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## [0.43.3]
|
|
2
|
+
- Stability
|
|
3
|
+
|
|
1
4
|
## [0.43.2]
|
|
2
5
|
- Introduced `@meshagent/meshagent-livekit` as a standalone TypeScript helper package, with `livekit-client ^2.15.5`.
|
|
3
6
|
- Reworked `@meshagent/meshagent-agents` packaging for dual ESM/CommonJS/browser resolution, including `.js` specifiers, module-scoped `src/`, and an ESM-default export.
|
|
@@ -170,6 +170,7 @@ export declare class AgentProviderInfo {
|
|
|
170
170
|
readonly name: string;
|
|
171
171
|
readonly friendlyName: string;
|
|
172
172
|
readonly description?: string;
|
|
173
|
+
readonly backend?: string;
|
|
173
174
|
readonly defaultModel: string;
|
|
174
175
|
readonly models: AgentModelInfo[];
|
|
175
176
|
constructor(params: JsonMap);
|
|
@@ -492,6 +492,7 @@ class AgentProviderInfo {
|
|
|
492
492
|
this.name = String(params.name);
|
|
493
493
|
this.friendlyName = String(params.friendlyName ?? params.friendly_name);
|
|
494
494
|
this.description = stringOrNull(params.description);
|
|
495
|
+
this.backend = stringOrNull(params.backend);
|
|
495
496
|
this.defaultModel = String(params.defaultModel ?? params.default_model);
|
|
496
497
|
this.models = Array.isArray(params.models) ? params.models.map((entry) => entry instanceof AgentModelInfo ? entry : AgentModelInfo.fromJson(requiredObjectValue(entry))) : [];
|
|
497
498
|
}
|
|
@@ -503,6 +504,7 @@ class AgentProviderInfo {
|
|
|
503
504
|
name: this.name,
|
|
504
505
|
friendly_name: this.friendlyName,
|
|
505
506
|
...(this.description != null ? { description: this.description } : {}),
|
|
507
|
+
...(this.backend != null ? { backend: this.backend } : {}),
|
|
506
508
|
default_model: this.defaultModel,
|
|
507
509
|
models: this.models.map((entry) => entry.toJson()),
|
|
508
510
|
};
|
|
@@ -630,11 +632,12 @@ class AgentContextWindowUsage {
|
|
|
630
632
|
this.compactionThreshold = intOrNull(params.compactionThreshold ?? params.compaction_threshold);
|
|
631
633
|
}
|
|
632
634
|
static fromJson(json) {
|
|
635
|
+
const usedTokens = intOrNull(json.used_tokens ?? json.usedTokens) ?? 0;
|
|
633
636
|
return new AgentContextWindowUsage({
|
|
634
|
-
usedTokens
|
|
635
|
-
totalTokens: intOrNull(json.total_tokens),
|
|
636
|
-
compactionMode: stringOrNull(json.compaction_mode),
|
|
637
|
-
compactionThreshold: intOrNull(json.compaction_threshold),
|
|
637
|
+
usedTokens,
|
|
638
|
+
totalTokens: intOrNull(json.total_tokens ?? json.totalTokens),
|
|
639
|
+
compactionMode: stringOrNull(json.compaction_mode ?? json.compactionMode),
|
|
640
|
+
compactionThreshold: intOrNull(json.compaction_threshold ?? json.compactionThreshold),
|
|
638
641
|
});
|
|
639
642
|
}
|
|
640
643
|
toJson() {
|
|
@@ -878,6 +881,7 @@ const turnOptions = [
|
|
|
878
881
|
s("turnId"),
|
|
879
882
|
contentList("content"),
|
|
880
883
|
s("provider"),
|
|
884
|
+
s("backend"),
|
|
881
885
|
s("model"),
|
|
882
886
|
s("voice"),
|
|
883
887
|
sl("outputModalities"),
|
|
@@ -912,6 +916,7 @@ exports.StartThread = makeMessageClass({
|
|
|
912
916
|
s("name"),
|
|
913
917
|
s("realtimeProtocol"),
|
|
914
918
|
s("provider"),
|
|
919
|
+
s("backend"),
|
|
915
920
|
s("model"),
|
|
916
921
|
s("voice"),
|
|
917
922
|
sl("outputModalities"),
|
|
@@ -943,8 +948,8 @@ exports.CapabilitiesRequest = makeMessageClass({ type: exports.agentCapabilities
|
|
|
943
948
|
exports.CapabilitiesResponse = makeMessageClass({ type: exports.agentCapabilitiesResponseType, base: "thread", fields: [s("sourceMessageId", "source_message_id", true), s("version", "version", true), objList("toolkits", "toolkits", ToolkitCapabilities.fromJson, true)] });
|
|
944
949
|
exports.ModelsRequest = makeMessageClass({ type: exports.agentModelsRequestType });
|
|
945
950
|
exports.ModelsResponse = makeMessageClass({ type: exports.agentModelsResponseType, fields: [s("sourceMessageId", "source_message_id", true), objList("providers", "providers", AgentProviderInfo.fromJson, true)] });
|
|
946
|
-
exports.ChangeModel = makeMessageClass({ type: exports.agentModelChangeType, base: "thread", fields: [s("provider"), s("model"), s("voice")] });
|
|
947
|
-
exports.AgentModelChanged = makeMessageClass({ type: exports.agentModelChangedType, base: "thread", fields: [s("sourceMessageId"), s("provider", "provider", true), s("model", "model", true), s("voice"), audioFormat("inputFormat"), audioFormat("outputFormat"), s("turnDetection"), sl("outputModalities", "output_modalities", ["text"], true), sl("realtimeProtocols", "realtime_protocols", [], true)] });
|
|
951
|
+
exports.ChangeModel = makeMessageClass({ type: exports.agentModelChangeType, base: "thread", fields: [s("backend"), s("provider"), s("model"), s("voice")] });
|
|
952
|
+
exports.AgentModelChanged = makeMessageClass({ type: exports.agentModelChangedType, base: "thread", fields: [s("sourceMessageId"), s("backend"), s("provider", "provider", true), s("model", "model", true), s("voice"), audioFormat("inputFormat"), audioFormat("outputFormat"), s("turnDetection"), sl("outputModalities", "output_modalities", ["text"], true), sl("realtimeProtocols", "realtime_protocols", [], true), { prop: "supportsAttachments", json: "supports_attachments", from: (value) => value === true, default: () => false }, sl("accepts", "accepts", [], true)] });
|
|
948
953
|
exports.ThreadCleared = makeMessageClass({ type: exports.agentThreadClearedType, base: "thread", fields: [s("sourceMessageId", "source_message_id", true)] });
|
|
949
954
|
exports.TurnStartAccepted = makeMessageClass({ type: exports.agentTurnStartAcceptedType, base: "thread", fields: [s("turnId"), s("sourceMessageId", "source_message_id", true), contentList("content")] });
|
|
950
955
|
exports.TurnStartRejected = makeMessageClass({ type: exports.agentTurnStartRejectedType, base: "thread", fields: [s("sourceMessageId", "source_message_id", true), obj("error", "error", AgentError.fromJson, true)] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RemoteParticipant } from "@meshagent/meshagent";
|
|
2
2
|
import type { RoomClient, Content } from "@meshagent/meshagent";
|
|
3
|
-
import { AgentMessage, AgentConnectionStatus } from "./agent-messages.js";
|
|
3
|
+
import { AgentMessage, AgentModelChanged, AgentThreadStatus, ModelsResponse, AgentConnectionStatus } from "./agent-messages.js";
|
|
4
4
|
import type { AgentPayload, JsonMap, ClientToolkitDescription } from "./agent-messages.js";
|
|
5
5
|
import { ChangeEmitter } from "./change-emitter.js";
|
|
6
6
|
export declare class AgentMessageEvent {
|
|
@@ -78,6 +78,7 @@ export declare class ChatThreadStartResult {
|
|
|
78
78
|
export declare abstract class BaseChatClient extends ChangeEmitter {
|
|
79
79
|
private readonly sessionsByPath;
|
|
80
80
|
private readonly pendingStartRequests;
|
|
81
|
+
private readonly pendingSessionEventsByPath;
|
|
81
82
|
private readonly eventQueue;
|
|
82
83
|
private _connectionStatus?;
|
|
83
84
|
get events(): AsyncIterable<AgentMessageEvent>;
|
|
@@ -88,16 +89,19 @@ export declare abstract class BaseChatClient extends ChangeEmitter {
|
|
|
88
89
|
agentParticipant(): RemoteParticipant | null;
|
|
89
90
|
localParticipantName(): string | undefined;
|
|
90
91
|
protected cleanParticipantName(value: string | undefined): string | undefined;
|
|
91
|
-
openThread(threadPath: string, { load, sinceTurn, reloadIfOpen }?: {
|
|
92
|
+
openThread(threadPath: string, { load, sinceTurn, reloadIfOpen, drainPendingEvents, }?: {
|
|
92
93
|
load?: boolean;
|
|
93
94
|
sinceTurn?: string;
|
|
94
95
|
reloadIfOpen?: boolean;
|
|
96
|
+
drainPendingEvents?: boolean;
|
|
95
97
|
}): ChatThreadSession;
|
|
96
|
-
|
|
98
|
+
private openSession;
|
|
99
|
+
startThread({ messageId, message, attachments, name, backend, provider, model, voice, outputModalities, realtimeProtocol, senderName, clientToolkits, omitContent, }: {
|
|
97
100
|
messageId?: string;
|
|
98
101
|
message: string;
|
|
99
102
|
attachments: string[];
|
|
100
103
|
name?: string;
|
|
104
|
+
backend?: string;
|
|
101
105
|
provider?: string;
|
|
102
106
|
model?: string;
|
|
103
107
|
voice?: string;
|
|
@@ -111,6 +115,7 @@ export declare abstract class BaseChatClient extends ChangeEmitter {
|
|
|
111
115
|
attachment?: Uint8Array;
|
|
112
116
|
ignoreOffline?: boolean;
|
|
113
117
|
}): Promise<void>;
|
|
118
|
+
private drainPendingSessionEvents;
|
|
114
119
|
handleAgentMessage(message: AgentMessage, { attachment }?: {
|
|
115
120
|
attachment?: Uint8Array;
|
|
116
121
|
}): void;
|
|
@@ -126,9 +131,7 @@ export declare class MessagingChatClient extends BaseChatClient {
|
|
|
126
131
|
readonly room: RoomClient;
|
|
127
132
|
readonly agentName?: string;
|
|
128
133
|
private readonly pendingParticipantWaits;
|
|
129
|
-
private readonly roomAbortController;
|
|
130
134
|
private started;
|
|
131
|
-
private roomPump?;
|
|
132
135
|
constructor({ room, agentName }: {
|
|
133
136
|
room: RoomClient;
|
|
134
137
|
agentName?: string;
|
|
@@ -145,17 +148,24 @@ export declare class MessagingChatClient extends BaseChatClient {
|
|
|
145
148
|
ignoreOffline?: boolean;
|
|
146
149
|
}): Promise<void>;
|
|
147
150
|
private readonly onMessagingChanged;
|
|
148
|
-
private
|
|
149
|
-
private onRoomEvent;
|
|
151
|
+
private readonly onMessagingMessage;
|
|
150
152
|
}
|
|
151
153
|
export declare class ChatThreadSession extends ChangeEmitter {
|
|
152
154
|
private readonly client;
|
|
153
155
|
readonly threadPath: string;
|
|
154
156
|
private readonly _messages;
|
|
157
|
+
private readonly messageIndexes;
|
|
158
|
+
private readonly localAgentMessageIds;
|
|
159
|
+
private readonly pendingLocalInputMessageIds;
|
|
160
|
+
private readonly mergedDeltaMessageIds;
|
|
155
161
|
private readonly pendingInputsById;
|
|
156
162
|
private openState;
|
|
157
163
|
private loadStateValue;
|
|
158
164
|
private lastCompletedTurnIdValue?;
|
|
165
|
+
private activeTurnIdValue?;
|
|
166
|
+
private threadStatusValue?;
|
|
167
|
+
private currentModelValue?;
|
|
168
|
+
private modelsResponseValue?;
|
|
159
169
|
private lastAgentMessageType?;
|
|
160
170
|
private lastAgentMessageAt?;
|
|
161
171
|
constructor({ client, threadPath }: {
|
|
@@ -168,6 +178,10 @@ export declare class ChatThreadSession extends ChangeEmitter {
|
|
|
168
178
|
get loadState(): ChatThreadSessionLoadState;
|
|
169
179
|
get isLoading(): boolean;
|
|
170
180
|
get lastCompletedTurnId(): string | undefined;
|
|
181
|
+
get activeTurnId(): string | undefined;
|
|
182
|
+
get threadStatus(): InstanceType<typeof AgentThreadStatus> | undefined;
|
|
183
|
+
get currentModel(): InstanceType<typeof AgentModelChanged> | undefined;
|
|
184
|
+
get modelsResponse(): InstanceType<typeof ModelsResponse> | undefined;
|
|
171
185
|
open({ load, sinceTurn }?: {
|
|
172
186
|
load?: boolean;
|
|
173
187
|
sinceTurn?: string;
|
|
@@ -176,7 +190,8 @@ export declare class ChatThreadSession extends ChangeEmitter {
|
|
|
176
190
|
requestModels({ ignoreOffline }?: {
|
|
177
191
|
ignoreOffline?: boolean;
|
|
178
192
|
}): Promise<void>;
|
|
179
|
-
changeModel({ provider, model, voice }: {
|
|
193
|
+
changeModel({ backend, provider, model, voice }: {
|
|
194
|
+
backend?: string;
|
|
180
195
|
provider: string;
|
|
181
196
|
model: string;
|
|
182
197
|
voice?: string;
|
|
@@ -187,12 +202,13 @@ export declare class ChatThreadSession extends ChangeEmitter {
|
|
|
187
202
|
requestId: string;
|
|
188
203
|
response: Content;
|
|
189
204
|
}): Promise<void>;
|
|
190
|
-
sendText({ messageId, text, attachments, steer, turnId, provider, model, voice, outputModalities, senderName, clientToolkits, }: {
|
|
205
|
+
sendText({ messageId, text, attachments, steer, turnId, backend, provider, model, voice, outputModalities, senderName, clientToolkits, }: {
|
|
191
206
|
messageId?: string;
|
|
192
207
|
text: string;
|
|
193
208
|
attachments: string[];
|
|
194
209
|
steer?: boolean;
|
|
195
210
|
turnId?: string;
|
|
211
|
+
backend?: string;
|
|
196
212
|
provider?: string;
|
|
197
213
|
model?: string;
|
|
198
214
|
voice?: string;
|
|
@@ -214,6 +230,14 @@ export declare class ChatThreadSession extends ChangeEmitter {
|
|
|
214
230
|
deleteThread(threadPath: string): Promise<void>;
|
|
215
231
|
renameThread(threadPath: string, name: string): Promise<void>;
|
|
216
232
|
addAgentMessage(event: AgentMessageEvent): void;
|
|
233
|
+
private updateSessionState;
|
|
234
|
+
private updatePendingInputsForMessage;
|
|
235
|
+
private appendRenderableMessage;
|
|
236
|
+
private appendMessage;
|
|
237
|
+
private upsertItemMessage;
|
|
238
|
+
private appendOrMergeDelta;
|
|
239
|
+
private indexMessagesFrom;
|
|
240
|
+
private applyActiveModel;
|
|
217
241
|
markClosed({ notify }?: {
|
|
218
242
|
notify?: boolean;
|
|
219
243
|
}): void;
|