@adecore/agents 0.26.1 → 0.26.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/dist/chat/chat-core.js +7 -2
- package/dist/chat/thread.d.ts +2 -1
- package/dist/chat/thread.js +6 -1
- package/package.json +3 -3
- package/src/chat/chat-core.ts +7 -2
- package/src/chat/thread.ts +17 -2
package/dist/chat/chat-core.js
CHANGED
|
@@ -396,12 +396,17 @@ export class ChatCore {
|
|
|
396
396
|
if (events !== null) {
|
|
397
397
|
return { info: session.info, items: [], events: [...events, ...session.uiPreviews], seq: log.seq };
|
|
398
398
|
}
|
|
399
|
-
|
|
399
|
+
if (historyLimit === undefined) {
|
|
400
|
+
const snapshot = session.thread.snapshot();
|
|
401
|
+
return { ...snapshot, info: session.info, items: session.previewItems(snapshot.items), seq: log.seq };
|
|
402
|
+
}
|
|
403
|
+
const page = session.thread.history(historyLimit);
|
|
400
404
|
return {
|
|
401
405
|
...page,
|
|
402
406
|
info: session.info,
|
|
403
407
|
items: session.previewItems(page.items),
|
|
404
|
-
|
|
408
|
+
pending: session.previewItems(session.thread.pending()),
|
|
409
|
+
subagents: session.thread.subagentsBefore(page.history.start),
|
|
405
410
|
seq: log.seq
|
|
406
411
|
};
|
|
407
412
|
}
|
package/dist/chat/thread.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentStatus, type ChatApprovalItem, type ChatEvent, type ChatHistoryResult, type ChatInfo, type ChatItem, type ChatQuestionItem, type ChatSubagentItem } from '@adecore/agent-contracts';
|
|
2
2
|
export declare class ChatThread {
|
|
3
3
|
info: ChatInfo;
|
|
4
4
|
private readonly items;
|
|
@@ -27,6 +27,7 @@ export declare class ChatThread {
|
|
|
27
27
|
pending(): Array<ChatApprovalItem | ChatQuestionItem>;
|
|
28
28
|
private syncRequests;
|
|
29
29
|
history(limit?: number, cursor?: string): ChatHistoryResult;
|
|
30
|
+
subagentsBefore(start: number): ChatSubagentItem[];
|
|
30
31
|
snapshot(): {
|
|
31
32
|
info: ChatInfo;
|
|
32
33
|
items: ChatItem[];
|
package/dist/chat/thread.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { activeSubagents } from '@adecore/agent-contracts';
|
|
2
3
|
import { appendToolOutput } from '@adecore/agent-contracts/text';
|
|
3
4
|
import { ChatError } from './errors.js';
|
|
4
5
|
import { requestSummaries } from './request-summary.js';
|
|
@@ -142,7 +143,7 @@ export class ChatThread {
|
|
|
142
143
|
const pending = this.pending();
|
|
143
144
|
this.info = pending.length === 0 ? rest : { ...rest, requests: requestSummaries(pending) };
|
|
144
145
|
}
|
|
145
|
-
history(limit =
|
|
146
|
+
history(limit = 90, cursor) {
|
|
146
147
|
let end = this.order.length;
|
|
147
148
|
if (cursor) {
|
|
148
149
|
const [generation, offset] = cursor.split(':');
|
|
@@ -167,6 +168,10 @@ export class ChatThread {
|
|
|
167
168
|
}
|
|
168
169
|
return { items, history: { start, cursor: start ? `${this.historyGeneration}:${start}` : null } };
|
|
169
170
|
}
|
|
171
|
+
/* The active sub-agents a page that begins at `start` leaves out. */
|
|
172
|
+
subagentsBefore(start) {
|
|
173
|
+
return activeSubagents(this.list()).filter((item) => this.indices.get(item.id) < start);
|
|
174
|
+
}
|
|
170
175
|
snapshot() {
|
|
171
176
|
return { info: this.info, items: this.list() };
|
|
172
177
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agents",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3",
|
|
4
4
|
"description": "Node-compatible agent chat hosts, providers, accounts, usage and durable task coordination.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"test": "bun --conditions=source test"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@adecore/agent-contracts": "0.26.
|
|
85
|
-
"@adecore/intelligent-ui": "0.26.
|
|
84
|
+
"@adecore/agent-contracts": "0.26.3",
|
|
85
|
+
"@adecore/intelligent-ui": "0.26.3",
|
|
86
86
|
"zod": "^4.6.5"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
package/src/chat/chat-core.ts
CHANGED
|
@@ -597,12 +597,17 @@ export class ChatCore {
|
|
|
597
597
|
if (events !== null) {
|
|
598
598
|
return { info: session.info, items: [], events: [...events, ...session.uiPreviews], seq: log.seq };
|
|
599
599
|
}
|
|
600
|
-
|
|
600
|
+
if (historyLimit === undefined) {
|
|
601
|
+
const snapshot = session.thread.snapshot();
|
|
602
|
+
return { ...snapshot, info: session.info, items: session.previewItems(snapshot.items), seq: log.seq };
|
|
603
|
+
}
|
|
604
|
+
const page = session.thread.history(historyLimit);
|
|
601
605
|
return {
|
|
602
606
|
...page,
|
|
603
607
|
info: session.info,
|
|
604
608
|
items: session.previewItems(page.items),
|
|
605
|
-
|
|
609
|
+
pending: session.previewItems(session.thread.pending()),
|
|
610
|
+
subagents: session.thread.subagentsBefore(page.history.start),
|
|
606
611
|
seq: log.seq
|
|
607
612
|
};
|
|
608
613
|
}
|
package/src/chat/thread.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
activeSubagents,
|
|
4
|
+
type AgentStatus,
|
|
5
|
+
type ChatApprovalItem,
|
|
6
|
+
type ChatEvent,
|
|
7
|
+
type ChatHistoryResult,
|
|
8
|
+
type ChatInfo,
|
|
9
|
+
type ChatItem,
|
|
10
|
+
type ChatQuestionItem,
|
|
11
|
+
type ChatSubagentItem
|
|
12
|
+
} from '@adecore/agent-contracts';
|
|
3
13
|
import { appendToolOutput } from '@adecore/agent-contracts/text';
|
|
4
14
|
import { ChatError } from './errors.ts';
|
|
5
15
|
import { requestSummaries } from './request-summary.ts';
|
|
@@ -164,7 +174,7 @@ export class ChatThread {
|
|
|
164
174
|
this.info = pending.length === 0 ? rest : { ...rest, requests: requestSummaries(pending) };
|
|
165
175
|
}
|
|
166
176
|
|
|
167
|
-
history(limit =
|
|
177
|
+
history(limit = 90, cursor?: string): ChatHistoryResult {
|
|
168
178
|
let end = this.order.length;
|
|
169
179
|
if (cursor) {
|
|
170
180
|
const [generation, offset] = cursor.split(':');
|
|
@@ -190,6 +200,11 @@ export class ChatThread {
|
|
|
190
200
|
return { items, history: { start, cursor: start ? `${this.historyGeneration}:${start}` : null } };
|
|
191
201
|
}
|
|
192
202
|
|
|
203
|
+
/* The active sub-agents a page that begins at `start` leaves out. */
|
|
204
|
+
subagentsBefore(start: number): ChatSubagentItem[] {
|
|
205
|
+
return activeSubagents(this.list()).filter((item) => this.indices.get(item.id)! < start);
|
|
206
|
+
}
|
|
207
|
+
|
|
193
208
|
snapshot(): { info: ChatInfo; items: ChatItem[] } {
|
|
194
209
|
return { info: this.info, items: this.list() };
|
|
195
210
|
}
|