graphlit-client 1.0.20250610003 → 1.0.20250610005
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/README.md
CHANGED
@@ -223,8 +223,7 @@ await client.streamAgent(
|
|
223
223
|
undefined, // tools
|
224
224
|
undefined, // toolHandlers
|
225
225
|
{
|
226
|
-
maxToolRounds: 10, // Maximum tool calling rounds (default:
|
227
|
-
showTokenStream: true, // Show individual tokens (default: true)
|
226
|
+
maxToolRounds: 10, // Maximum tool calling rounds (default: 1000)
|
228
227
|
smoothingEnabled: true, // Enable smooth streaming (default: true)
|
229
228
|
chunkingStrategy: 'word', // 'character' | 'word' | 'sentence' (default: 'word')
|
230
229
|
smoothingDelay: 30, // Milliseconds between chunks (default: 30)
|
package/dist/client.js
CHANGED
@@ -31,6 +31,7 @@ try {
|
|
31
31
|
catch (e) {
|
32
32
|
// Google Generative AI not installed
|
33
33
|
}
|
34
|
+
const DEFAULT_MAX_TOOL_ROUNDS = 1000;
|
34
35
|
// Provider categorization for streaming capabilities
|
35
36
|
const STREAMING_PROVIDERS = {
|
36
37
|
// Native streaming with dedicated SDKs
|
@@ -1448,7 +1449,7 @@ class Graphlit {
|
|
1448
1449
|
async promptAgent(prompt, conversationId, specification, tools, toolHandlers, options, mimeType, data, // base64 encoded
|
1449
1450
|
correlationId) {
|
1450
1451
|
const startTime = Date.now();
|
1451
|
-
const maxRounds = options?.maxToolRounds ||
|
1452
|
+
const maxRounds = options?.maxToolRounds || DEFAULT_MAX_TOOL_ROUNDS;
|
1452
1453
|
const timeout = options?.timeout || 300000; // 5 minutes default
|
1453
1454
|
// Create abort controller for timeout
|
1454
1455
|
const abortController = new AbortController();
|
@@ -1534,7 +1535,7 @@ class Graphlit {
|
|
1534
1535
|
*/
|
1535
1536
|
async streamAgent(prompt, onEvent, conversationId, specification, tools, toolHandlers, options, mimeType, data, // base64 encoded
|
1536
1537
|
correlationId) {
|
1537
|
-
const maxRounds = options?.maxToolRounds ||
|
1538
|
+
const maxRounds = options?.maxToolRounds || DEFAULT_MAX_TOOL_ROUNDS;
|
1538
1539
|
const abortSignal = options?.abortSignal;
|
1539
1540
|
let uiAdapter;
|
1540
1541
|
// Check if already aborted
|
@@ -1567,7 +1568,6 @@ class Graphlit {
|
|
1567
1568
|
}
|
1568
1569
|
// Create UI event adapter
|
1569
1570
|
uiAdapter = new UIEventAdapter(onEvent, actualConversationId, {
|
1570
|
-
showTokenStream: options?.showTokenStream ?? true,
|
1571
1571
|
smoothingEnabled: options?.smoothingEnabled ?? true,
|
1572
1572
|
chunkingStrategy: options?.chunkingStrategy ?? "word",
|
1573
1573
|
smoothingDelay: options?.smoothingDelay ?? 30,
|
@@ -14,12 +14,10 @@ export declare class UIEventAdapter {
|
|
14
14
|
private activeToolCalls;
|
15
15
|
private lastUpdateTime;
|
16
16
|
private updateTimer?;
|
17
|
-
private showTokenStream;
|
18
17
|
private chunkBuffer?;
|
19
18
|
private smoothingDelay;
|
20
19
|
private chunkQueue;
|
21
20
|
constructor(onEvent: (event: AgentStreamEvent) => void, conversationId: string, options?: {
|
22
|
-
showTokenStream?: boolean;
|
23
21
|
smoothingEnabled?: boolean;
|
24
22
|
chunkingStrategy?: ChunkingStrategy;
|
25
23
|
smoothingDelay?: number;
|
@@ -13,14 +13,12 @@ export class UIEventAdapter {
|
|
13
13
|
activeToolCalls = new Map();
|
14
14
|
lastUpdateTime = 0;
|
15
15
|
updateTimer;
|
16
|
-
showTokenStream;
|
17
16
|
chunkBuffer;
|
18
17
|
smoothingDelay = 30;
|
19
18
|
chunkQueue = []; // Queue of chunks waiting to be emitted
|
20
19
|
constructor(onEvent, conversationId, options = {}) {
|
21
20
|
this.onEvent = onEvent;
|
22
21
|
this.conversationId = conversationId;
|
23
|
-
this.showTokenStream = options.showTokenStream ?? true;
|
24
22
|
this.smoothingDelay = options.smoothingDelay ?? 30;
|
25
23
|
if (options.smoothingEnabled) {
|
26
24
|
this.chunkBuffer = new ChunkBuffer(options.chunkingStrategy || "word");
|
@@ -35,9 +33,7 @@ export class UIEventAdapter {
|
|
35
33
|
this.handleStart(event.conversationId);
|
36
34
|
break;
|
37
35
|
case "token":
|
38
|
-
|
39
|
-
this.handleToken(event.token);
|
40
|
-
}
|
36
|
+
this.handleToken(event.token);
|
41
37
|
break;
|
42
38
|
case "message":
|
43
39
|
this.handleMessage(event.message);
|
package/dist/types/agent.d.ts
CHANGED
@@ -11,9 +11,8 @@ export interface AgentResult {
|
|
11
11
|
export interface StreamAgentOptions {
|
12
12
|
maxToolRounds?: number;
|
13
13
|
abortSignal?: AbortSignal;
|
14
|
-
showTokenStream?: boolean;
|
15
14
|
smoothingEnabled?: boolean;
|
16
|
-
chunkingStrategy?:
|
15
|
+
chunkingStrategy?: "character" | "word" | "sentence";
|
17
16
|
smoothingDelay?: number;
|
18
17
|
}
|
19
18
|
export interface ToolCallResult {
|