@gaunt-sloth/core 0.1.8 → 2.0.0-alpha.0

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.
Files changed (53) hide show
  1. package/.gsloth.exec.md +26 -0
  2. package/dist/config.d.ts +81 -1
  3. package/dist/config.js +118 -3
  4. package/dist/config.js.map +1 -1
  5. package/dist/constants.d.ts +1 -0
  6. package/dist/constants.js +1 -0
  7. package/dist/constants.js.map +1 -1
  8. package/dist/core/GthAbstractAgent.d.ts +73 -0
  9. package/dist/core/GthAbstractAgent.js +448 -0
  10. package/dist/core/GthAbstractAgent.js.map +1 -0
  11. package/dist/core/GthAgentRunner.d.ts +21 -2
  12. package/dist/core/GthAgentRunner.js +30 -2
  13. package/dist/core/GthAgentRunner.js.map +1 -1
  14. package/dist/core/GthLangChainAgent.d.ts +9 -75
  15. package/dist/core/GthLangChainAgent.js +13 -433
  16. package/dist/core/GthLangChainAgent.js.map +1 -1
  17. package/dist/core/types.d.ts +63 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +1 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/providers/anthropic.js +2 -2
  22. package/dist/providers/deepseek.js +2 -2
  23. package/dist/providers/deepseek.js.map +1 -1
  24. package/dist/providers/google-genai.js +2 -2
  25. package/dist/providers/google-genai.js.map +1 -1
  26. package/dist/providers/modelDiscovery.d.ts +196 -0
  27. package/dist/providers/modelDiscovery.js +362 -0
  28. package/dist/providers/modelDiscovery.js.map +1 -0
  29. package/dist/providers/ollama.d.ts +5 -0
  30. package/dist/providers/ollama.js +79 -0
  31. package/dist/providers/ollama.js.map +1 -0
  32. package/dist/providers/openai.js +28 -2
  33. package/dist/providers/openai.js.map +1 -1
  34. package/dist/providers/vertexai.js +2 -2
  35. package/dist/providers/vertexai.js.map +1 -1
  36. package/dist/providers/xai.js +2 -2
  37. package/dist/providers/xai.js.map +1 -1
  38. package/dist/runtime/singleShot.d.ts +19 -0
  39. package/dist/runtime/singleShot.js +62 -0
  40. package/dist/runtime/singleShot.js.map +1 -0
  41. package/dist/utils/fileUtils.d.ts +6 -0
  42. package/dist/utils/fileUtils.js +17 -0
  43. package/dist/utils/fileUtils.js.map +1 -1
  44. package/dist/utils/globalConfigUtils.d.ts +21 -0
  45. package/dist/utils/globalConfigUtils.js +25 -0
  46. package/dist/utils/globalConfigUtils.js.map +1 -1
  47. package/dist/utils/llmUtils.d.ts +1 -0
  48. package/dist/utils/llmUtils.js +4 -1
  49. package/dist/utils/llmUtils.js.map +1 -1
  50. package/dist/utils/systemUtils.d.ts +10 -0
  51. package/dist/utils/systemUtils.js +8 -0
  52. package/dist/utils/systemUtils.js.map +1 -1
  53. package/package.json +17 -14
@@ -1,79 +1,13 @@
1
1
  import { GthConfig } from '#src/config.js';
2
- import { AgentResolvers, GthAgentInterface, GthCommand, Message, StatusUpdateCallback } from '#src/core/types.js';
3
- import { BaseMessage } from '@langchain/core/messages';
4
- import { RunnableConfig } from '@langchain/core/runnables';
5
- import { IterableReadableStream } from '@langchain/core/utils/stream';
2
+ import { GthCommand } from '#src/core/types.js';
3
+ import { GthAbstractAgent } from '#src/core/GthAbstractAgent.js';
6
4
  import { BaseCheckpointSaver } from '@langchain/langgraph';
7
- export type AgentStreamEvent = {
8
- type: 'text';
9
- delta: string;
10
- } | {
11
- type: 'reasoning_start';
12
- } | {
13
- type: 'reasoning_delta';
14
- delta: string;
15
- } | {
16
- type: 'reasoning_end';
17
- } | {
18
- type: 'tool_start';
19
- id: string;
20
- name: string;
21
- } | {
22
- type: 'tool_args';
23
- id: string;
24
- delta: string;
25
- } | {
26
- type: 'tool_end';
27
- id: string;
28
- } | {
29
- type: 'tool_result';
30
- id: string;
31
- content: string;
32
- };
33
- export declare class GthLangChainAgent implements GthAgentInterface {
34
- private statusUpdate;
35
- private resolvers;
36
- private agent;
37
- private config;
38
- private command;
39
- constructor(statusUpdate: StatusUpdateCallback, resolvers?: AgentResolvers);
5
+ export type { AgentStreamEvent } from '#src/core/types.js';
6
+ /**
7
+ * Lean agent: builds a standard `createAgent` (ReAct) graph. All run/stream/event
8
+ * plumbing lives in {@link GthAbstractAgent}; this class only knows how to construct
9
+ * the graph in {@link init}.
10
+ */
11
+ export declare class GthLangChainAgent extends GthAbstractAgent {
40
12
  init(command: GthCommand | undefined, configIn: GthConfig, checkpointer?: BaseCheckpointSaver | undefined): Promise<void>;
41
- /**
42
- * Invoke LLM with a message and runnable config.
43
- * For streaming use {@link #stream} method, streaming is preferred if model API supports it.
44
- * Please note that this when tools are involved, this method will anyway do multiple LLM
45
- * calls within LangChain dependency.
46
- */
47
- invoke(messages: Message[], runConfig: RunnableConfig): Promise<string>;
48
- /**
49
- * Induce LLM to stream AI messages with a user message and runnable config.
50
- * When stream is not appropriate use {@link invoke}.
51
- */
52
- stream(messages: Message[], runConfig: RunnableConfig): Promise<IterableReadableStream<string>>;
53
- /**
54
- * Stream agent events as typed AgentStreamEvent objects.
55
- * Yields text deltas, tool call lifecycle events, and tool results.
56
- *
57
- * If a tool with `metadata.client === true` triggers `interrupt()`, the underlying
58
- * graph throws `GraphInterrupt`; this generator catches it and ends cleanly so the
59
- * caller's transport (e.g. AG-UI SSE) can finish the run with the tool call hanging.
60
- * Resume the suspended graph via {@link streamWithEventsResume} on the same thread id.
61
- */
62
- streamWithEvents(messages: Message[], runConfig: RunnableConfig, signal?: AbortSignal): AsyncGenerator<AgentStreamEvent>;
63
- /**
64
- * Resume a graph that was suspended via `interrupt()` with the supplied value.
65
- *
66
- * The runnable config must carry the same `thread_id` used when the graph was
67
- * suspended (the checkpointer keys state by thread). The resume value is whatever
68
- * the suspending tool needs back — for frontend-fulfilled tools this is the value
69
- * the client sends in `forwardedProps.command.resume`.
70
- */
71
- streamWithEventsResume(resumeValue: unknown, runConfig: RunnableConfig, queuedMessages?: BaseMessage[], signal?: AbortSignal): AsyncGenerator<AgentStreamEvent>;
72
- private processEventStream;
73
- cleanup(): Promise<void>;
74
- getEffectiveConfig(config: GthConfig, command: GthCommand | undefined): GthConfig;
75
- /**
76
- * Extract and flatten tools from toolkits
77
- */
78
- private extractAndFlattenTools;
79
13
  }
@@ -1,25 +1,16 @@
1
- import { StatusLevel, } from '#src/core/types.js';
2
- import { debugLog, debugLogError, debugLogObject } from '#src/utils/debugUtils.js';
1
+ import { StatusLevel } from '#src/core/types.js';
2
+ import { GthAbstractAgent } from '#src/core/GthAbstractAgent.js';
3
+ import { debugLog, debugLogObject } from '#src/utils/debugUtils.js';
3
4
  import { formatToolCalls } from '#src/utils/llmUtils.js';
4
- import { ProgressIndicator } from '#src/utils/ProgressIndicator.js';
5
- import { stopWaitingForEscape, waitForEscape, getCurrentWorkDir } from '#src/utils/systemUtils.js';
6
- import { AIMessage, AIMessageChunk, ToolMessage } from '@langchain/core/messages';
7
- import { IterableReadableStream } from '@langchain/core/utils/stream';
8
- import { interrupt, Command, GraphInterrupt } from '@langchain/langgraph';
5
+ import { getCurrentWorkDir } from '#src/utils/systemUtils.js';
6
+ import { AIMessage } from '@langchain/core/messages';
9
7
  import { createAgent, createMiddleware } from 'langchain';
10
- import { extractInlineBinaryBlocks, materializeBinaryOutputs, renderAssistantContent, } from '#src/utils/binaryOutputUtils.js';
11
- export class GthLangChainAgent {
12
- statusUpdate;
13
- resolvers;
14
- agent = null;
15
- config = null;
16
- command = undefined;
17
- constructor(statusUpdate, resolvers) {
18
- this.statusUpdate = (level, message) => {
19
- statusUpdate(level, message);
20
- };
21
- this.resolvers = resolvers;
22
- }
8
+ /**
9
+ * Lean agent: builds a standard `createAgent` (ReAct) graph. All run/stream/event
10
+ * plumbing lives in {@link GthAbstractAgent}; this class only knows how to construct
11
+ * the graph in {@link init}.
12
+ */
13
+ export class GthLangChainAgent extends GthAbstractAgent {
23
14
  async init(command, configIn, checkpointer) {
24
15
  this.command = command;
25
16
  debugLog(`GthLangChainAgent.init called with command: ${command || 'default'}`);
@@ -81,6 +72,7 @@ export class GthLangChainAgent {
81
72
  this.config.middleware, this.config)
82
73
  : [];
83
74
  // Add tool call status update middleware
75
+ const statusUpdate = this.statusUpdate;
84
76
  const toolCallStatusMiddleware = createMiddleware({
85
77
  name: 'GthMiddlewareToolCallStatusUpdate',
86
78
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -90,7 +82,7 @@ export class GthLangChainAgent {
90
82
  if (AIMessage.isInstance(lastMessage) &&
91
83
  lastMessage.tool_calls &&
92
84
  lastMessage.tool_calls?.length > 0) {
93
- this.statusUpdate(StatusLevel.INFO, `\nRequested tools: ${formatToolCalls(lastMessage.tool_calls)}\n`);
85
+ statusUpdate(StatusLevel.INFO, `\nRequested tools: ${formatToolCalls(lastMessage.tool_calls)}\n`);
94
86
  }
95
87
  return state;
96
88
  },
@@ -107,417 +99,5 @@ export class GthLangChainAgent {
107
99
  });
108
100
  debugLog('React agent created successfully');
109
101
  }
110
- /**
111
- * Invoke LLM with a message and runnable config.
112
- * For streaming use {@link #stream} method, streaming is preferred if model API supports it.
113
- * Please note that this when tools are involved, this method will anyway do multiple LLM
114
- * calls within LangChain dependency.
115
- */
116
- async invoke(messages, runConfig) {
117
- if (!this.agent || !this.config) {
118
- throw new Error('Agent not initialized. Call init() first.');
119
- }
120
- debugLog('=== Starting non-streaming invoke ===');
121
- debugLogObject('LLM Input Messages', messages);
122
- debugLogObject('Invoke RunConfig', runConfig);
123
- try {
124
- const progress = new ProgressIndicator('Thinking.');
125
- try {
126
- debugLog('Calling agent.invoke...');
127
- const response = await this.agent.invoke({ messages }, runConfig);
128
- const finalMessage = response.messages[response.messages.length - 1];
129
- const finalContent = finalMessage?.content;
130
- const processedContent = !this.config.writeBinaryOutputsToFile
131
- ? {
132
- renderedContent: renderAssistantContent(finalContent),
133
- successMessages: [],
134
- }
135
- : materializeBinaryOutputs(finalContent, this.command);
136
- if (processedContent.renderedContent.trim().length > 0) {
137
- this.statusUpdate(StatusLevel.DISPLAY, processedContent.renderedContent);
138
- }
139
- for (const successMessage of processedContent.successMessages) {
140
- this.statusUpdate(StatusLevel.SUCCESS, successMessage);
141
- }
142
- return [processedContent.renderedContent, ...processedContent.successMessages]
143
- .filter((part) => part.trim().length > 0)
144
- .join('\n');
145
- }
146
- catch (e) {
147
- debugLogError('invoke inner', e);
148
- if (e instanceof Error && e?.name === 'ToolException') {
149
- throw e; // Re-throw ToolException to be handled by outer catch
150
- }
151
- const message = e instanceof Error ? e.message : String(e);
152
- this.statusUpdate(StatusLevel.ERROR, `LLM invocation failed: ${message}`);
153
- throw e;
154
- }
155
- finally {
156
- progress.stop();
157
- }
158
- }
159
- catch (error) {
160
- debugLogError('invoke outer', error);
161
- if (error instanceof Error) {
162
- if (error?.name === 'ToolException') {
163
- this.statusUpdate(StatusLevel.ERROR, `Tool execution failed: ${error?.message}`);
164
- return `Tool execution failed: ${error?.message}`;
165
- }
166
- }
167
- throw error;
168
- }
169
- }
170
- /**
171
- * Induce LLM to stream AI messages with a user message and runnable config.
172
- * When stream is not appropriate use {@link invoke}.
173
- */
174
- async stream(messages, runConfig) {
175
- if (!this.agent || !this.config) {
176
- throw new Error('Agent not initialized. Call init() first.');
177
- }
178
- debugLog('=== Starting streaming invoke ===');
179
- debugLogObject('LLM Input Messages', messages);
180
- debugLogObject('Stream RunConfig', runConfig);
181
- this.statusUpdate(StatusLevel.INFO, '\nThinking...\n');
182
- const statusUpdate = this.statusUpdate;
183
- const config = this.config;
184
- const command = this.command;
185
- const interruptState = { escape: false, messageShown: false };
186
- const abortController = new AbortController();
187
- const showInterruptMessage = () => {
188
- if (!interruptState.messageShown) {
189
- interruptState.messageShown = true;
190
- statusUpdate(StatusLevel.WARNING, '\n\nInterrupted by user, exiting\n\n');
191
- }
192
- };
193
- waitForEscape(() => {
194
- interruptState.escape = true;
195
- showInterruptMessage();
196
- if (!abortController.signal.aborted) {
197
- abortController.abort();
198
- }
199
- }, this.config.canInterruptInferenceWithEsc);
200
- let stream;
201
- try {
202
- stream = await this.agent.stream({ messages }, { ...runConfig, streamMode: 'messages', signal: abortController.signal });
203
- }
204
- catch (error) {
205
- // If stream creation fails (e.g. an auth error), the IterableReadableStream below -
206
- // whose finally/cancel are what normally unregister the Escape listener - is never
207
- // constructed. Without this cleanup the raw-mode keypress listener keeps stdin ref'd,
208
- // the process hangs after the error, and Esc/Ctrl+C only print "Interrupting..."
209
- // (raw mode swallows SIGINT, so Ctrl+C cannot kill the process either).
210
- stopWaitingForEscape();
211
- throw error;
212
- }
213
- return new IterableReadableStream({
214
- async start(controller) {
215
- try {
216
- debugLog('Starting stream processing...');
217
- let totalChunks = 0;
218
- const seenBinaryBlocks = new Set();
219
- const binaryBlocks = [];
220
- for await (const [chunk, _metadata] of stream) {
221
- debugLogObject('Stream chunk', { chunk, _metadata });
222
- if (AIMessage.isInstance(chunk)) {
223
- const text = chunk.text ?? '';
224
- totalChunks++;
225
- if (text.length > 0) {
226
- statusUpdate(StatusLevel.STREAM, text);
227
- controller.enqueue(text);
228
- }
229
- if (config?.writeBinaryOutputsToFile) {
230
- for (const block of extractInlineBinaryBlocks(chunk.content)) {
231
- const binaryKey = `${block.mimeType}:${block.data.length}:${block.data}`;
232
- if (seenBinaryBlocks.has(binaryKey)) {
233
- continue;
234
- }
235
- seenBinaryBlocks.add(binaryKey);
236
- binaryBlocks.push({ mimeType: block.mimeType, data: block.data });
237
- }
238
- }
239
- }
240
- if (interruptState.escape) {
241
- if (typeof stream.cancel === 'function') {
242
- await stream.cancel();
243
- }
244
- break;
245
- }
246
- }
247
- if (config?.writeBinaryOutputsToFile && binaryBlocks.length > 0) {
248
- const processedContent = materializeBinaryOutputs(binaryBlocks.map((block) => ({
249
- type: 'inlineData',
250
- inlineData: block,
251
- })), command);
252
- for (const successMessage of processedContent.successMessages) {
253
- statusUpdate(StatusLevel.SUCCESS, successMessage);
254
- }
255
- }
256
- debugLog(`Stream completed. Total chunks: ${totalChunks}`);
257
- controller.close();
258
- }
259
- catch (error) {
260
- if (interruptState.escape || (error instanceof Error && error.name === 'AbortError')) {
261
- showInterruptMessage();
262
- controller.close();
263
- }
264
- else {
265
- debugLogError('stream processing', error);
266
- if (error instanceof Error) {
267
- if (error?.name === 'ToolException') {
268
- statusUpdate(StatusLevel.ERROR, `Tool execution failed: ${error?.message}`);
269
- }
270
- }
271
- controller.error(error);
272
- }
273
- }
274
- finally {
275
- stopWaitingForEscape();
276
- }
277
- },
278
- async cancel() {
279
- stopWaitingForEscape();
280
- if (!abortController.signal.aborted) {
281
- abortController.abort();
282
- }
283
- // Clean up the underlying stream if it has a cancel method
284
- if (stream && typeof stream.cancel === 'function') {
285
- await stream.cancel();
286
- }
287
- },
288
- });
289
- }
290
- /**
291
- * Stream agent events as typed AgentStreamEvent objects.
292
- * Yields text deltas, tool call lifecycle events, and tool results.
293
- *
294
- * If a tool with `metadata.client === true` triggers `interrupt()`, the underlying
295
- * graph throws `GraphInterrupt`; this generator catches it and ends cleanly so the
296
- * caller's transport (e.g. AG-UI SSE) can finish the run with the tool call hanging.
297
- * Resume the suspended graph via {@link streamWithEventsResume} on the same thread id.
298
- */
299
- async *streamWithEvents(messages, runConfig, signal) {
300
- if (!this.agent || !this.config) {
301
- throw new Error('Agent not initialized. Call init() first.');
302
- }
303
- debugLog('=== Starting streamWithEvents ===');
304
- debugLogObject('LLM Input Messages', messages);
305
- try {
306
- // `signal` lets the transport (e.g. the AG-UI server on client disconnect)
307
- // cancel the in-flight LLM generation, not just stop reading from it.
308
- const stream = await this.agent.stream({ messages }, { ...runConfig, streamMode: 'messages', signal });
309
- yield* this.processEventStream(stream);
310
- }
311
- catch (e) {
312
- if (e instanceof GraphInterrupt ||
313
- e.name === 'GraphInterrupt' ||
314
- e.name === 'AbortError') {
315
- debugLog('Graph suspended (GraphInterrupt) or aborted by caller');
316
- return;
317
- }
318
- throw e;
319
- }
320
- }
321
- /**
322
- * Resume a graph that was suspended via `interrupt()` with the supplied value.
323
- *
324
- * The runnable config must carry the same `thread_id` used when the graph was
325
- * suspended (the checkpointer keys state by thread). The resume value is whatever
326
- * the suspending tool needs back — for frontend-fulfilled tools this is the value
327
- * the client sends in `forwardedProps.command.resume`.
328
- */
329
- async *streamWithEventsResume(resumeValue, runConfig, queuedMessages, signal) {
330
- if (!this.agent || !this.config) {
331
- throw new Error('Agent not initialized. Call init() first.');
332
- }
333
- debugLog('=== Starting streamWithEventsResume ===');
334
- try {
335
- // Queued follow-up messages: when the client sends mid-task input
336
- // alongside the resume, append it to the graph's `messages` state via
337
- // Command.update so the agent sees it on its next decision turn — no
338
- // separate run, no dangling tool calls. (Ordering note: the update lands
339
- // around the resumed tool result; lenient local models tolerate this,
340
- // strict tool-call/result adjacency providers may not.)
341
- const command = queuedMessages && queuedMessages.length > 0
342
- ? new Command({ resume: resumeValue, update: { messages: queuedMessages } })
343
- : new Command({ resume: resumeValue });
344
- const stream = await this.agent.stream(command, {
345
- ...runConfig,
346
- streamMode: 'messages',
347
- signal,
348
- });
349
- yield* this.processEventStream(stream);
350
- }
351
- catch (e) {
352
- if (e instanceof GraphInterrupt ||
353
- e.name === 'GraphInterrupt' ||
354
- e.name === 'AbortError') {
355
- debugLog('Graph suspended (GraphInterrupt) or aborted by caller');
356
- return;
357
- }
358
- throw e;
359
- }
360
- }
361
- async *processEventStream(stream) {
362
- // Aggregate AIMessageChunks via concat so tool_call_chunks collapse into
363
- // tool_calls with complete args (per-chunk tool_calls only ever sees that
364
- // chunk's slice of the args JSON, which is rarely valid on its own).
365
- let aggregatedAIChunk = null;
366
- let reasoningOpen = false;
367
- const flushed = new Set();
368
- function* flushAggregated() {
369
- if (!aggregatedAIChunk)
370
- return;
371
- const toolCalls = aggregatedAIChunk.tool_calls ?? [];
372
- const invalidToolCalls = aggregatedAIChunk.invalid_tool_calls ?? [];
373
- for (const tc of toolCalls) {
374
- const id = tc.id;
375
- if (!id || flushed.has(id))
376
- continue;
377
- flushed.add(id);
378
- yield { type: 'tool_start', id, name: tc.name };
379
- yield { type: 'tool_args', id, delta: JSON.stringify(tc.args ?? {}) };
380
- yield { type: 'tool_end', id };
381
- }
382
- // Surface invalid tool calls too so the client at least sees the raw args
383
- // string the model produced, instead of silently dropping them.
384
- for (const tc of invalidToolCalls) {
385
- const id = tc.id;
386
- if (!id || flushed.has(id))
387
- continue;
388
- flushed.add(id);
389
- yield { type: 'tool_start', id, name: tc.name ?? '' };
390
- yield { type: 'tool_args', id, delta: tc.args ?? '' };
391
- yield { type: 'tool_end', id };
392
- }
393
- }
394
- for await (const [chunk, _metadata] of stream) {
395
- debugLogObject('streamWithEvents chunk', { chunk, _metadata });
396
- if (AIMessageChunk.isInstance(chunk)) {
397
- aggregatedAIChunk = aggregatedAIChunk ? aggregatedAIChunk.concat(chunk) : chunk;
398
- // Reasoning deltas — Ollama (Qwen3, deepseek-r1) and Anthropic surface
399
- // thinking text in additional_kwargs.reasoning_content. Stream it as a
400
- // separate event series so clients can render it apart from the answer.
401
- const reasoningDelta = chunk.additional_kwargs?.reasoning_content;
402
- if (typeof reasoningDelta === 'string' && reasoningDelta.length > 0) {
403
- if (!reasoningOpen) {
404
- reasoningOpen = true;
405
- yield { type: 'reasoning_start' };
406
- }
407
- yield { type: 'reasoning_delta', delta: reasoningDelta };
408
- }
409
- // Yield text incrementally — use this chunk's text (delta), not the
410
- // aggregated content which is cumulative.
411
- if (chunk.text) {
412
- if (reasoningOpen) {
413
- reasoningOpen = false;
414
- yield { type: 'reasoning_end' };
415
- }
416
- yield { type: 'text', delta: chunk.text };
417
- }
418
- }
419
- else if (AIMessage.isInstance(chunk)) {
420
- // Non-chunk AIMessage (e.g. on resumed runs) carries final tool_calls
421
- // directly; merge them into the aggregate so flushAggregated emits them.
422
- if (chunk.tool_calls && chunk.tool_calls.length > 0) {
423
- const synthetic = new AIMessageChunk({
424
- content: '',
425
- tool_calls: chunk.tool_calls,
426
- });
427
- aggregatedAIChunk = aggregatedAIChunk ? aggregatedAIChunk.concat(synthetic) : synthetic;
428
- }
429
- if (chunk.text) {
430
- if (reasoningOpen) {
431
- reasoningOpen = false;
432
- yield { type: 'reasoning_end' };
433
- }
434
- yield { type: 'text', delta: chunk.text };
435
- }
436
- }
437
- if (chunk instanceof ToolMessage) {
438
- if (reasoningOpen) {
439
- reasoningOpen = false;
440
- yield { type: 'reasoning_end' };
441
- }
442
- yield* flushAggregated();
443
- // Reset between rounds. OpenAI restarts tool_call_chunks.index at 0
444
- // for each new LLM round; without this reset the next round's chunks
445
- // collide with the previous round's groups in collapseToolCallChunks
446
- // and end up with empty args.
447
- aggregatedAIChunk = null;
448
- const content = typeof chunk.content === 'string' ? chunk.content : JSON.stringify(chunk.content);
449
- yield { type: 'tool_result', id: chunk.tool_call_id, content };
450
- }
451
- }
452
- // Close any still-open reasoning block before flushing tool calls.
453
- if (reasoningOpen) {
454
- reasoningOpen = false;
455
- yield { type: 'reasoning_end' };
456
- }
457
- // Flush any tool calls not followed by a ToolMessage (e.g. terminal tool calls).
458
- yield* flushAggregated();
459
- }
460
- async cleanup() {
461
- debugLog('Cleaning up GthLangChainAgent...');
462
- if (this.resolvers?.cleanupTools) {
463
- await this.resolvers.cleanupTools();
464
- }
465
- if (this.resolvers?.cleanupMiddleware) {
466
- await this.resolvers.cleanupMiddleware();
467
- }
468
- this.agent = null;
469
- this.config = null;
470
- this.command = undefined;
471
- debugLog('GthLangChainAgent cleanup complete');
472
- }
473
- getEffectiveConfig(config, command) {
474
- debugLog(`Getting effective config for command: ${command || 'default'}`);
475
- const supportsTools = !!config.llm.bindTools;
476
- if (!supportsTools) {
477
- this.statusUpdate(StatusLevel.WARNING, 'Model does not seem to support tools.');
478
- debugLog('Warning: Model does not support tools');
479
- }
480
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
481
- const cmdConfig = (command && config.commands?.[command]);
482
- return {
483
- ...config,
484
- filesystem: cmdConfig?.filesystem !== undefined ? cmdConfig.filesystem : config.filesystem,
485
- builtInTools: cmdConfig?.builtInTools !== undefined ? cmdConfig.builtInTools : config.builtInTools,
486
- allowedTools: cmdConfig?.allowedTools !== undefined ? cmdConfig.allowedTools : config.allowedTools,
487
- binaryFormats: cmdConfig?.binaryFormats !== undefined ? cmdConfig.binaryFormats : config.binaryFormats,
488
- };
489
- }
490
- /**
491
- * Extract and flatten tools from toolkits
492
- */
493
- extractAndFlattenTools(tools) {
494
- const flattenedTools = [];
495
- for (const toolOrToolkit of tools) {
496
- // eslint-disable-next-line
497
- if (toolOrToolkit['getTools'] instanceof Function) {
498
- // This is a toolkit
499
- flattenedTools.push(...toolOrToolkit.getTools());
500
- }
501
- else {
502
- // This is a regular tool
503
- let singleTool = toolOrToolkit;
504
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
505
- if (singleTool.metadata?.client === true) {
506
- // Clone the tool to avoid mutating the original
507
- singleTool = Object.assign(Object.create(Object.getPrototypeOf(singleTool)), singleTool);
508
- const stubFunc = async (_input, _config) => {
509
- const value = await interrupt({ name: singleTool.name });
510
- return typeof value === 'string' ? value : JSON.stringify(value);
511
- };
512
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
513
- singleTool.invoke = stubFunc;
514
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
515
- singleTool.call = stubFunc;
516
- }
517
- flattenedTools.push(singleTool);
518
- }
519
- }
520
- return flattenedTools;
521
- }
522
102
  }
523
103
  //# sourceMappingURL=GthLangChainAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GthLangChainAgent.js","sourceRoot":"","sources":["../../src/core/GthLangChainAgent.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,WAAW,GAEZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,cAAc,EAAe,WAAW,EAAE,MAAM,0BAA0B,C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