@adecore/agents 0.48.1 → 0.48.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.
@@ -22,6 +22,10 @@ function continuedNoteId(turnId) {
22
22
  function newId(prefix) {
23
23
  return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
24
24
  }
25
+ /* The note of what the agent heard in front of a prompt, which a person reads in the turn it opened. */
26
+ function saidNote(turnId, now, text) {
27
+ return { id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text, said: true };
28
+ }
25
29
  /*
26
30
  * Item and request ids carry the generation of the CLI that made them, and a restart of the host
27
31
  * must not hand out one a stored thread already holds. Starting from the clock puts every run above
@@ -834,7 +838,7 @@ export class ChatSession {
834
838
  const context = this.contextNote(words.prompt);
835
839
  const preamble = [words.preamble, context.preamble].filter(Boolean).join('\n\n') || null;
836
840
  if (context.note) {
837
- this.emit([this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: context.note })]);
841
+ this.emit([this.thread.upsert(saidNote(turnId, now, context.note))]);
838
842
  }
839
843
  const input = { promptId: randomUUID(), text: words.prompt, preamble, attachments: [], mentions: [], skills: [] };
840
844
  this.submission = { turnId, input };
@@ -900,7 +904,7 @@ export class ChatSession {
900
904
  ...(wake.note === undefined
901
905
  ? []
902
906
  : [this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: wake.note })]),
903
- ...(note === null ? [] : [this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: note })]),
907
+ ...(note === null ? [] : [this.thread.upsert(saidNote(turnId, now, note))]),
904
908
  this.thread.patchInfo({ status: this.thread.statusFor(turnId), activeTurnId: turnId })
905
909
  ]);
906
910
  this.options.persist();
@@ -1383,7 +1387,7 @@ export class ChatSession {
1383
1387
  const now = Date.now();
1384
1388
  const events = [this.thread.upsert({ id: turnId, kind: 'turn', createdAt: now, turnId, state: 'running', origin: 'user', endedAt: null, costUsd: 0 })];
1385
1389
  if (note !== null) {
1386
- events.push(this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: note }));
1390
+ events.push(this.thread.upsert(saidNote(turnId, now, note)));
1387
1391
  }
1388
1392
  if (text !== null) {
1389
1393
  const mentions = extras.mentions?.length ? extras.mentions : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents",
3
- "version": "0.48.1",
3
+ "version": "0.48.3",
4
4
  "description": "Node-compatible agent chat hosts, providers, accounts, usage and durable task coordination.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -93,8 +93,8 @@
93
93
  "test": "bun --conditions=source test"
94
94
  },
95
95
  "dependencies": {
96
- "@adecore/agent-contracts": "0.48.1",
97
- "@adecore/intelligent-ui": "0.48.1",
96
+ "@adecore/agent-contracts": "0.48.3",
97
+ "@adecore/intelligent-ui": "0.48.3",
98
98
  "zod": "^4.6.7"
99
99
  },
100
100
  "devDependencies": {
@@ -6,6 +6,7 @@ import type {
6
6
  ChatGoalAction,
7
7
  ChatInfo,
8
8
  ChatItem,
9
+ ChatNoteItem,
9
10
  ChatNoteMessage,
10
11
  ChatQueuedMessage,
11
12
  ChatQuoteSource,
@@ -157,6 +158,11 @@ function newId(prefix: string): string {
157
158
  return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
158
159
  }
159
160
 
161
+ /* The note of what the agent heard in front of a prompt, which a person reads in the turn it opened. */
162
+ function saidNote(turnId: string, now: number, text: string): ChatNoteItem {
163
+ return { id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text, said: true };
164
+ }
165
+
160
166
  /*
161
167
  * Item and request ids carry the generation of the CLI that made them, and a restart of the host
162
168
  * must not hand out one a stored thread already holds. Starting from the clock puts every run above
@@ -1184,7 +1190,7 @@ export class ChatSession {
1184
1190
  const preamble = [words.preamble, context.preamble].filter(Boolean).join('\n\n') || null;
1185
1191
 
1186
1192
  if (context.note) {
1187
- this.emit([this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: context.note })]);
1193
+ this.emit([this.thread.upsert(saidNote(turnId, now, context.note))]);
1188
1194
  }
1189
1195
 
1190
1196
  const input: TurnInput = { promptId: randomUUID(), text: words.prompt, preamble, attachments: [], mentions: [], skills: [] };
@@ -1271,7 +1277,7 @@ export class ChatSession {
1271
1277
  ...(wake.note === undefined
1272
1278
  ? []
1273
1279
  : [this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: wake.note })]),
1274
- ...(note === null ? [] : [this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: note })]),
1280
+ ...(note === null ? [] : [this.thread.upsert(saidNote(turnId, now, note))]),
1275
1281
  this.thread.patchInfo({ status: this.thread.statusFor(turnId), activeTurnId: turnId })
1276
1282
  ]);
1277
1283
 
@@ -1878,7 +1884,7 @@ export class ChatSession {
1878
1884
  const events = [this.thread.upsert({ id: turnId, kind: 'turn', createdAt: now, turnId, state: 'running', origin: 'user', endedAt: null, costUsd: 0 })];
1879
1885
 
1880
1886
  if (note !== null) {
1881
- events.push(this.thread.upsert({ id: newId('note'), kind: 'note', createdAt: now, turnId, level: 'info', text: note }));
1887
+ events.push(this.thread.upsert(saidNote(turnId, now, note)));
1882
1888
  }
1883
1889
 
1884
1890
  if (text !== null) {