@myagentroam/node 0.9.104 → 0.9.105

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.
@@ -1,5 +1,16 @@
1
1
  const TURN_PAGE_SIZE = 30;
2
+ function conversationSegmentPrefix(turn) {
3
+ const user = turn.items.find((item) => item.kind === 'user_message');
4
+ const payload = typeof user?.payload === 'object' && user.payload !== null && !Array.isArray(user.payload)
5
+ ? user.payload
6
+ : undefined;
7
+ const clientMessageId = payload?.clientMessageId;
8
+ return typeof clientMessageId === 'string' && clientMessageId.length > 0
9
+ ? `${turn.sessionId}:message:${clientMessageId}`
10
+ : turn.id;
11
+ }
2
12
  export function conversationSegments(turn) {
13
+ const prefix = conversationSegmentPrefix(turn);
3
14
  const groups = [];
4
15
  let current = [];
5
16
  for (const item of turn.items) {
@@ -12,7 +23,7 @@ export function conversationSegments(turn) {
12
23
  if (current.length > 0 || groups.length === 0)
13
24
  groups.push(current);
14
25
  return groups.map((items, index) => {
15
- const id = `${turn.id}:segment:${index}`;
26
+ const id = `${prefix}:segment:${index}`;
16
27
  const latest = index === groups.length - 1;
17
28
  const projectedItems = items.map((item) => ({
18
29
  ...item,
@@ -35,6 +46,7 @@ export function conversationSegments(turn) {
35
46
  });
36
47
  }
37
48
  export function conversationSegmentIdentityForItem(turn, itemId, itemKind) {
49
+ const prefix = conversationSegmentPrefix(turn);
38
50
  let index = 0;
39
51
  const runtimeItemId = turn.runId === null ? itemId : `${turn.runId}:${itemId}`;
40
52
  for (const [itemIndex, item] of turn.items.entries()) {
@@ -42,11 +54,11 @@ export function conversationSegmentIdentityForItem(turn, itemId, itemKind) {
42
54
  if (previous?.kind === 'assistant_message' && item.kind !== 'assistant_message')
43
55
  index += 1;
44
56
  if (item.id === itemId || item.id === runtimeItemId)
45
- return { id: `${turn.id}:segment:${index}`, index };
57
+ return { id: `${prefix}:segment:${index}`, index };
46
58
  }
47
59
  if (turn.items.at(-1)?.kind === 'assistant_message' && itemKind !== 'assistant_message')
48
60
  index += 1;
49
- return { id: `${turn.id}:segment:${index}`, index };
61
+ return { id: `${prefix}:segment:${index}`, index };
50
62
  }
51
63
  export class ConversationSegmentService {
52
64
  readTurns;
@@ -258,6 +258,12 @@ export class HostedConversationNodeService {
258
258
  const displayVersionId = latestVersionId ?? conversation.activeVersionId;
259
259
  const version = await this.loadTemplateVersion(displayVersionId, conversation.templateId);
260
260
  const models = networkModels(allowedModels(version, availableModels), version.draft.networkMode);
261
+ if (models.length > 0) {
262
+ const configuredModelId = conversation.modelId;
263
+ const selected = selectModel(version, availableModels, conversation.modelId);
264
+ if (selected.id !== conversation.modelId)
265
+ conversation = await this.options.store.updateConversation(conversation.id, (current) => current.modelId === configuredModelId ? { ...current, modelId: selected.id } : current);
266
+ }
261
267
  const paths = this.options.store.pathsForConversation(userId, conversation.id);
262
268
  const history = historyOverride ??
263
269
  (await this.options.runtime.history({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/node",
3
- "version": "0.9.104",
3
+ "version": "0.9.105",
4
4
  "description": "MyAgentRoam Node runtime CLI.",
5
5
  "license": "Apache-2.0 AND GPL-2.0-or-later",
6
6
  "type": "module",
@@ -30,9 +30,9 @@
30
30
  "npm": "11.12.1",
31
31
  "ws": "^8.21.3",
32
32
  "zod": "4.4.3",
33
- "@myagentroam/agent": "0.9.104",
34
- "@myagentroam/protocol": "0.9.104",
35
- "@myagentroam/code-navigation": "0.9.104"
33
+ "@myagentroam/agent": "0.9.105",
34
+ "@myagentroam/code-navigation": "0.9.105",
35
+ "@myagentroam/protocol": "0.9.105"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/ws": "^8.18.1"