llmist 0.5.1 → 0.6.1
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/{chunk-MH4TQ5AD.js → chunk-KB7LMYC2.js} +745 -287
- package/dist/chunk-KB7LMYC2.js.map +1 -0
- package/dist/{chunk-VF2WOCHM.js → chunk-YWJSGEYT.js} +4 -2
- package/dist/{chunk-VF2WOCHM.js.map → chunk-YWJSGEYT.js.map} +1 -1
- package/dist/cli.cjs +3167 -2686
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +94 -48
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +751 -304
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -3
- package/dist/index.d.ts +112 -3
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/{mock-stream-C8mBXRzJ.d.cts → mock-stream-CCe8vISa.d.cts} +45 -1
- package/dist/{mock-stream-C8mBXRzJ.d.ts → mock-stream-CCe8vISa.d.ts} +45 -1
- package/dist/testing/index.cjs +740 -287
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-LKIBXQ5I.js +0 -23
- package/dist/chunk-LKIBXQ5I.js.map +0 -1
- package/dist/chunk-MH4TQ5AD.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZodType, ZodTypeAny } from 'zod';
|
|
2
2
|
export { z } from 'zod';
|
|
3
|
-
import { A as AgentHooks, o as ModelRegistry, L as LLMMessage, P as ParameterFormat, S as StreamEvent, G as GadgetRegistry, p as LLMStreamChunk, q as GadgetExample, B as BaseGadget, r as ParsedGadgetCall, s as GadgetExecutionResult, t as ProviderAdapter, u as ModelDescriptor, v as ModelSpec, w as LLMGenerationOptions, x as LLMStream } from './mock-stream-
|
|
4
|
-
export { F as AfterGadgetExecutionAction, I as AfterGadgetExecutionControllerContext, J as AfterLLMCallAction, K as AfterLLMCallControllerContext, N as AfterLLMErrorAction, y as AgentBuilder, O as AgentOptions, Q as BeforeGadgetExecutionAction, R as BeforeLLMCallAction, T as ChunkInterceptorContext, U as Controllers, ab as CostEstimate, al as DEFAULT_PROMPTS, E as EventHandlers, as as GadgetClass, V as GadgetExecutionControllerContext, at as GadgetOrClass, W as GadgetParameterInterceptorContext, X as GadgetResultInterceptorContext, H as HistoryMessage, Y as Interceptors, Z as LLMCallControllerContext, _ as LLMErrorControllerContext, aa as LLMMessageBuilder, a9 as LLMRole, a8 as LLMist, a7 as LLMistOptions, $ as MessageInterceptorContext, a as MockBuilder, d as MockManager, h as MockMatcher, i as MockMatcherContext, j as MockOptions, M as MockProviderAdapter, k as MockRegistration, l as MockResponse, n as MockStats, ac as ModelFeatures, ah as ModelIdentifierParser, ad as ModelLimits, ae as ModelPricing, a0 as ObserveChunkContext, a1 as ObserveGadgetCompleteContext, a2 as ObserveGadgetStartContext, a3 as ObserveLLMCallContext, a4 as ObserveLLMCompleteContext, a5 as ObserveLLMErrorContext, a6 as Observers, ai as PromptConfig, aj as PromptContext, ak as PromptTemplate, af as ProviderIdentifier, ao as QuickOptions, ar as StreamParser, au as TextOnlyAction, av as TextOnlyContext, aw as TextOnlyCustomHandler, ax as TextOnlyGadgetConfig, ay as TextOnlyHandler, az as TextOnlyStrategy, ag as TokenUsage, z as collectEvents, C as collectText, ap as complete, c as createMockAdapter, b as createMockClient, e as createMockStream, f as createTextMockStream, g as getMockManager, m as mockLLM, am as resolvePromptTemplate, an as resolveRulesTemplate, D as runWithHandlers, aq as stream } from './mock-stream-
|
|
3
|
+
import { A as AgentHooks, o as ModelRegistry, L as LLMMessage, P as ParameterFormat, S as StreamEvent, G as GadgetRegistry, p as LLMStreamChunk, q as GadgetExample, B as BaseGadget, r as ParsedGadgetCall, s as GadgetExecutionResult, t as ProviderAdapter, u as ModelDescriptor, v as ModelSpec, w as LLMGenerationOptions, x as LLMStream } from './mock-stream-CCe8vISa.cjs';
|
|
4
|
+
export { F as AfterGadgetExecutionAction, I as AfterGadgetExecutionControllerContext, J as AfterLLMCallAction, K as AfterLLMCallControllerContext, N as AfterLLMErrorAction, y as AgentBuilder, O as AgentOptions, Q as BeforeGadgetExecutionAction, R as BeforeLLMCallAction, T as ChunkInterceptorContext, U as Controllers, ab as CostEstimate, al as DEFAULT_PROMPTS, E as EventHandlers, as as GadgetClass, V as GadgetExecutionControllerContext, at as GadgetOrClass, W as GadgetParameterInterceptorContext, X as GadgetResultInterceptorContext, H as HistoryMessage, Y as Interceptors, Z as LLMCallControllerContext, _ as LLMErrorControllerContext, aa as LLMMessageBuilder, a9 as LLMRole, a8 as LLMist, a7 as LLMistOptions, $ as MessageInterceptorContext, a as MockBuilder, d as MockManager, h as MockMatcher, i as MockMatcherContext, j as MockOptions, M as MockProviderAdapter, k as MockRegistration, l as MockResponse, n as MockStats, ac as ModelFeatures, ah as ModelIdentifierParser, ad as ModelLimits, ae as ModelPricing, a0 as ObserveChunkContext, a1 as ObserveGadgetCompleteContext, a2 as ObserveGadgetStartContext, a3 as ObserveLLMCallContext, a4 as ObserveLLMCompleteContext, a5 as ObserveLLMErrorContext, a6 as Observers, ai as PromptConfig, aj as PromptContext, ak as PromptTemplate, af as ProviderIdentifier, ao as QuickOptions, ar as StreamParser, au as TextOnlyAction, av as TextOnlyContext, aw as TextOnlyCustomHandler, ax as TextOnlyGadgetConfig, ay as TextOnlyHandler, az as TextOnlyStrategy, ag as TokenUsage, z as collectEvents, C as collectText, ap as complete, c as createMockAdapter, b as createMockClient, e as createMockStream, f as createTextMockStream, g as getMockManager, m as mockLLM, am as resolvePromptTemplate, an as resolveRulesTemplate, D as runWithHandlers, aq as stream } from './mock-stream-CCe8vISa.cjs';
|
|
5
5
|
import { Logger, ILogObj } from 'tslog';
|
|
6
6
|
import { MessageCreateParamsStreaming, MessageStreamEvent } from '@anthropic-ai/sdk/resources/messages';
|
|
7
7
|
import OpenAI from 'openai';
|
|
@@ -887,6 +887,91 @@ declare class StreamProcessor {
|
|
|
887
887
|
private determineErrorType;
|
|
888
888
|
}
|
|
889
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Storage for large gadget outputs that exceed the configured limit.
|
|
892
|
+
*
|
|
893
|
+
* When a gadget returns more data than the configured limit, the output
|
|
894
|
+
* is stored here and can be browsed later using GadgetOutputViewer.
|
|
895
|
+
*/
|
|
896
|
+
/**
|
|
897
|
+
* Metadata and content for a stored gadget output.
|
|
898
|
+
*/
|
|
899
|
+
interface StoredOutput {
|
|
900
|
+
/** Unique identifier (e.g., "Search_d34db33f") */
|
|
901
|
+
id: string;
|
|
902
|
+
/** Name of the gadget that produced this output */
|
|
903
|
+
gadgetName: string;
|
|
904
|
+
/** Full output content */
|
|
905
|
+
content: string;
|
|
906
|
+
/** Size in bytes */
|
|
907
|
+
byteSize: number;
|
|
908
|
+
/** Number of lines */
|
|
909
|
+
lineCount: number;
|
|
910
|
+
/** When the output was stored */
|
|
911
|
+
timestamp: Date;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* In-memory store for large gadget outputs.
|
|
915
|
+
*
|
|
916
|
+
* Outputs are stored with generated IDs in the format `{GadgetName}_{hex8}`.
|
|
917
|
+
* The store is tied to an agent run and cleared when the agent completes.
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* const store = new GadgetOutputStore();
|
|
922
|
+
* const id = store.store("Search", largeOutput);
|
|
923
|
+
* // id = "Search_a1b2c3d4"
|
|
924
|
+
*
|
|
925
|
+
* const stored = store.get(id);
|
|
926
|
+
* console.log(stored?.lineCount); // 4200
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
declare class GadgetOutputStore {
|
|
930
|
+
private outputs;
|
|
931
|
+
/**
|
|
932
|
+
* Store a gadget output and return its ID.
|
|
933
|
+
*
|
|
934
|
+
* @param gadgetName - Name of the gadget that produced the output
|
|
935
|
+
* @param content - Full output content to store
|
|
936
|
+
* @returns Generated ID for retrieving the output later
|
|
937
|
+
*/
|
|
938
|
+
store(gadgetName: string, content: string): string;
|
|
939
|
+
/**
|
|
940
|
+
* Retrieve a stored output by ID.
|
|
941
|
+
*
|
|
942
|
+
* @param id - The output ID (e.g., "Search_d34db33f")
|
|
943
|
+
* @returns The stored output or undefined if not found
|
|
944
|
+
*/
|
|
945
|
+
get(id: string): StoredOutput | undefined;
|
|
946
|
+
/**
|
|
947
|
+
* Check if an output exists.
|
|
948
|
+
*
|
|
949
|
+
* @param id - The output ID to check
|
|
950
|
+
* @returns True if the output exists
|
|
951
|
+
*/
|
|
952
|
+
has(id: string): boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Get all stored output IDs.
|
|
955
|
+
*
|
|
956
|
+
* @returns Array of output IDs
|
|
957
|
+
*/
|
|
958
|
+
getIds(): string[];
|
|
959
|
+
/**
|
|
960
|
+
* Get the number of stored outputs.
|
|
961
|
+
*/
|
|
962
|
+
get size(): number;
|
|
963
|
+
/**
|
|
964
|
+
* Clear all stored outputs.
|
|
965
|
+
* Called when the agent run completes.
|
|
966
|
+
*/
|
|
967
|
+
clear(): void;
|
|
968
|
+
/**
|
|
969
|
+
* Generate a unique ID for a stored output.
|
|
970
|
+
* Format: {GadgetName}_{8 hex chars}
|
|
971
|
+
*/
|
|
972
|
+
private generateId;
|
|
973
|
+
}
|
|
974
|
+
|
|
890
975
|
/**
|
|
891
976
|
* Model shortcuts and aliases for more expressive DX.
|
|
892
977
|
*
|
|
@@ -1107,6 +1192,24 @@ interface CreateGadgetConfig<TSchema extends ZodType> {
|
|
|
1107
1192
|
*/
|
|
1108
1193
|
declare function createGadget<TSchema extends ZodType>(config: CreateGadgetConfig<TSchema>): BaseGadget;
|
|
1109
1194
|
|
|
1195
|
+
/**
|
|
1196
|
+
* Create a GadgetOutputViewer gadget instance bound to a specific output store.
|
|
1197
|
+
*
|
|
1198
|
+
* This is a factory function because the gadget needs access to the output store,
|
|
1199
|
+
* which is created per-agent-run.
|
|
1200
|
+
*
|
|
1201
|
+
* @param store - The GadgetOutputStore to read outputs from
|
|
1202
|
+
* @returns A GadgetOutputViewer gadget instance
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* ```typescript
|
|
1206
|
+
* const store = new GadgetOutputStore();
|
|
1207
|
+
* const viewer = createGadgetOutputViewer(store);
|
|
1208
|
+
* registry.register("GadgetOutputViewer", viewer);
|
|
1209
|
+
* ```
|
|
1210
|
+
*/
|
|
1211
|
+
declare function createGadgetOutputViewer(store: GadgetOutputStore): BaseGadget;
|
|
1212
|
+
|
|
1110
1213
|
/**
|
|
1111
1214
|
* Exception that gadgets can throw to signal the agent loop should terminate.
|
|
1112
1215
|
*
|
|
@@ -1407,6 +1510,12 @@ interface LoggerOptions {
|
|
|
1407
1510
|
* Logger name (appears in logs)
|
|
1408
1511
|
*/
|
|
1409
1512
|
name?: string;
|
|
1513
|
+
/**
|
|
1514
|
+
* When true, reset (truncate) the log file instead of appending.
|
|
1515
|
+
* Useful for getting clean logs per session.
|
|
1516
|
+
* @default false
|
|
1517
|
+
*/
|
|
1518
|
+
logReset?: boolean;
|
|
1410
1519
|
}
|
|
1411
1520
|
/**
|
|
1412
1521
|
* Create a new logger instance for the library.
|
|
@@ -1660,4 +1769,4 @@ declare class OpenAIChatProvider extends BaseProviderAdapter {
|
|
|
1660
1769
|
}
|
|
1661
1770
|
declare function createOpenAIProviderFromEnv(): OpenAIChatProvider | null;
|
|
1662
1771
|
|
|
1663
|
-
export { AgentHooks, AnthropicMessagesProvider, BaseGadget, BreakLoopException, ConversationManager, type CreateGadgetConfig, Gadget, type GadgetConfig, GadgetExample, GadgetExecutionResult, GadgetExecutor, GadgetRegistry, GeminiGenerativeProvider, HookPresets, HumanInputException, type IConversationManager, LLMGenerationOptions, LLMMessage, LLMStream, LLMStreamChunk, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, ModelDescriptor, ModelRegistry, ModelSpec, OpenAIChatProvider, ParsedGadgetCall, ProviderAdapter, StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, type ValidationIssue, type ValidationResult, createAnthropicProviderFromEnv, createGadget, createGeminiProviderFromEnv, createLogger, createOpenAIProviderFromEnv, defaultLogger, discoverProviderAdapters, getModelId, getProvider, hasProviderPrefix, resolveModel, validateAndApplyDefaults, validateGadgetParams };
|
|
1772
|
+
export { AgentHooks, AnthropicMessagesProvider, BaseGadget, BreakLoopException, ConversationManager, type CreateGadgetConfig, Gadget, type GadgetConfig, GadgetExample, GadgetExecutionResult, GadgetExecutor, GadgetOutputStore, GadgetRegistry, GeminiGenerativeProvider, HookPresets, HumanInputException, type IConversationManager, LLMGenerationOptions, LLMMessage, LLMStream, LLMStreamChunk, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, ModelDescriptor, ModelRegistry, ModelSpec, OpenAIChatProvider, ParsedGadgetCall, ProviderAdapter, type StoredOutput, StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, type ValidationIssue, type ValidationResult, createAnthropicProviderFromEnv, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createLogger, createOpenAIProviderFromEnv, defaultLogger, discoverProviderAdapters, getModelId, getProvider, hasProviderPrefix, resolveModel, validateAndApplyDefaults, validateGadgetParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZodType, ZodTypeAny } from 'zod';
|
|
2
2
|
export { z } from 'zod';
|
|
3
|
-
import { A as AgentHooks, o as ModelRegistry, L as LLMMessage, P as ParameterFormat, S as StreamEvent, G as GadgetRegistry, p as LLMStreamChunk, q as GadgetExample, B as BaseGadget, r as ParsedGadgetCall, s as GadgetExecutionResult, t as ProviderAdapter, u as ModelDescriptor, v as ModelSpec, w as LLMGenerationOptions, x as LLMStream } from './mock-stream-
|
|
4
|
-
export { F as AfterGadgetExecutionAction, I as AfterGadgetExecutionControllerContext, J as AfterLLMCallAction, K as AfterLLMCallControllerContext, N as AfterLLMErrorAction, y as AgentBuilder, O as AgentOptions, Q as BeforeGadgetExecutionAction, R as BeforeLLMCallAction, T as ChunkInterceptorContext, U as Controllers, ab as CostEstimate, al as DEFAULT_PROMPTS, E as EventHandlers, as as GadgetClass, V as GadgetExecutionControllerContext, at as GadgetOrClass, W as GadgetParameterInterceptorContext, X as GadgetResultInterceptorContext, H as HistoryMessage, Y as Interceptors, Z as LLMCallControllerContext, _ as LLMErrorControllerContext, aa as LLMMessageBuilder, a9 as LLMRole, a8 as LLMist, a7 as LLMistOptions, $ as MessageInterceptorContext, a as MockBuilder, d as MockManager, h as MockMatcher, i as MockMatcherContext, j as MockOptions, M as MockProviderAdapter, k as MockRegistration, l as MockResponse, n as MockStats, ac as ModelFeatures, ah as ModelIdentifierParser, ad as ModelLimits, ae as ModelPricing, a0 as ObserveChunkContext, a1 as ObserveGadgetCompleteContext, a2 as ObserveGadgetStartContext, a3 as ObserveLLMCallContext, a4 as ObserveLLMCompleteContext, a5 as ObserveLLMErrorContext, a6 as Observers, ai as PromptConfig, aj as PromptContext, ak as PromptTemplate, af as ProviderIdentifier, ao as QuickOptions, ar as StreamParser, au as TextOnlyAction, av as TextOnlyContext, aw as TextOnlyCustomHandler, ax as TextOnlyGadgetConfig, ay as TextOnlyHandler, az as TextOnlyStrategy, ag as TokenUsage, z as collectEvents, C as collectText, ap as complete, c as createMockAdapter, b as createMockClient, e as createMockStream, f as createTextMockStream, g as getMockManager, m as mockLLM, am as resolvePromptTemplate, an as resolveRulesTemplate, D as runWithHandlers, aq as stream } from './mock-stream-
|
|
3
|
+
import { A as AgentHooks, o as ModelRegistry, L as LLMMessage, P as ParameterFormat, S as StreamEvent, G as GadgetRegistry, p as LLMStreamChunk, q as GadgetExample, B as BaseGadget, r as ParsedGadgetCall, s as GadgetExecutionResult, t as ProviderAdapter, u as ModelDescriptor, v as ModelSpec, w as LLMGenerationOptions, x as LLMStream } from './mock-stream-CCe8vISa.js';
|
|
4
|
+
export { F as AfterGadgetExecutionAction, I as AfterGadgetExecutionControllerContext, J as AfterLLMCallAction, K as AfterLLMCallControllerContext, N as AfterLLMErrorAction, y as AgentBuilder, O as AgentOptions, Q as BeforeGadgetExecutionAction, R as BeforeLLMCallAction, T as ChunkInterceptorContext, U as Controllers, ab as CostEstimate, al as DEFAULT_PROMPTS, E as EventHandlers, as as GadgetClass, V as GadgetExecutionControllerContext, at as GadgetOrClass, W as GadgetParameterInterceptorContext, X as GadgetResultInterceptorContext, H as HistoryMessage, Y as Interceptors, Z as LLMCallControllerContext, _ as LLMErrorControllerContext, aa as LLMMessageBuilder, a9 as LLMRole, a8 as LLMist, a7 as LLMistOptions, $ as MessageInterceptorContext, a as MockBuilder, d as MockManager, h as MockMatcher, i as MockMatcherContext, j as MockOptions, M as MockProviderAdapter, k as MockRegistration, l as MockResponse, n as MockStats, ac as ModelFeatures, ah as ModelIdentifierParser, ad as ModelLimits, ae as ModelPricing, a0 as ObserveChunkContext, a1 as ObserveGadgetCompleteContext, a2 as ObserveGadgetStartContext, a3 as ObserveLLMCallContext, a4 as ObserveLLMCompleteContext, a5 as ObserveLLMErrorContext, a6 as Observers, ai as PromptConfig, aj as PromptContext, ak as PromptTemplate, af as ProviderIdentifier, ao as QuickOptions, ar as StreamParser, au as TextOnlyAction, av as TextOnlyContext, aw as TextOnlyCustomHandler, ax as TextOnlyGadgetConfig, ay as TextOnlyHandler, az as TextOnlyStrategy, ag as TokenUsage, z as collectEvents, C as collectText, ap as complete, c as createMockAdapter, b as createMockClient, e as createMockStream, f as createTextMockStream, g as getMockManager, m as mockLLM, am as resolvePromptTemplate, an as resolveRulesTemplate, D as runWithHandlers, aq as stream } from './mock-stream-CCe8vISa.js';
|
|
5
5
|
import { Logger, ILogObj } from 'tslog';
|
|
6
6
|
import { MessageCreateParamsStreaming, MessageStreamEvent } from '@anthropic-ai/sdk/resources/messages';
|
|
7
7
|
import OpenAI from 'openai';
|
|
@@ -887,6 +887,91 @@ declare class StreamProcessor {
|
|
|
887
887
|
private determineErrorType;
|
|
888
888
|
}
|
|
889
889
|
|
|
890
|
+
/**
|
|
891
|
+
* Storage for large gadget outputs that exceed the configured limit.
|
|
892
|
+
*
|
|
893
|
+
* When a gadget returns more data than the configured limit, the output
|
|
894
|
+
* is stored here and can be browsed later using GadgetOutputViewer.
|
|
895
|
+
*/
|
|
896
|
+
/**
|
|
897
|
+
* Metadata and content for a stored gadget output.
|
|
898
|
+
*/
|
|
899
|
+
interface StoredOutput {
|
|
900
|
+
/** Unique identifier (e.g., "Search_d34db33f") */
|
|
901
|
+
id: string;
|
|
902
|
+
/** Name of the gadget that produced this output */
|
|
903
|
+
gadgetName: string;
|
|
904
|
+
/** Full output content */
|
|
905
|
+
content: string;
|
|
906
|
+
/** Size in bytes */
|
|
907
|
+
byteSize: number;
|
|
908
|
+
/** Number of lines */
|
|
909
|
+
lineCount: number;
|
|
910
|
+
/** When the output was stored */
|
|
911
|
+
timestamp: Date;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* In-memory store for large gadget outputs.
|
|
915
|
+
*
|
|
916
|
+
* Outputs are stored with generated IDs in the format `{GadgetName}_{hex8}`.
|
|
917
|
+
* The store is tied to an agent run and cleared when the agent completes.
|
|
918
|
+
*
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* const store = new GadgetOutputStore();
|
|
922
|
+
* const id = store.store("Search", largeOutput);
|
|
923
|
+
* // id = "Search_a1b2c3d4"
|
|
924
|
+
*
|
|
925
|
+
* const stored = store.get(id);
|
|
926
|
+
* console.log(stored?.lineCount); // 4200
|
|
927
|
+
* ```
|
|
928
|
+
*/
|
|
929
|
+
declare class GadgetOutputStore {
|
|
930
|
+
private outputs;
|
|
931
|
+
/**
|
|
932
|
+
* Store a gadget output and return its ID.
|
|
933
|
+
*
|
|
934
|
+
* @param gadgetName - Name of the gadget that produced the output
|
|
935
|
+
* @param content - Full output content to store
|
|
936
|
+
* @returns Generated ID for retrieving the output later
|
|
937
|
+
*/
|
|
938
|
+
store(gadgetName: string, content: string): string;
|
|
939
|
+
/**
|
|
940
|
+
* Retrieve a stored output by ID.
|
|
941
|
+
*
|
|
942
|
+
* @param id - The output ID (e.g., "Search_d34db33f")
|
|
943
|
+
* @returns The stored output or undefined if not found
|
|
944
|
+
*/
|
|
945
|
+
get(id: string): StoredOutput | undefined;
|
|
946
|
+
/**
|
|
947
|
+
* Check if an output exists.
|
|
948
|
+
*
|
|
949
|
+
* @param id - The output ID to check
|
|
950
|
+
* @returns True if the output exists
|
|
951
|
+
*/
|
|
952
|
+
has(id: string): boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Get all stored output IDs.
|
|
955
|
+
*
|
|
956
|
+
* @returns Array of output IDs
|
|
957
|
+
*/
|
|
958
|
+
getIds(): string[];
|
|
959
|
+
/**
|
|
960
|
+
* Get the number of stored outputs.
|
|
961
|
+
*/
|
|
962
|
+
get size(): number;
|
|
963
|
+
/**
|
|
964
|
+
* Clear all stored outputs.
|
|
965
|
+
* Called when the agent run completes.
|
|
966
|
+
*/
|
|
967
|
+
clear(): void;
|
|
968
|
+
/**
|
|
969
|
+
* Generate a unique ID for a stored output.
|
|
970
|
+
* Format: {GadgetName}_{8 hex chars}
|
|
971
|
+
*/
|
|
972
|
+
private generateId;
|
|
973
|
+
}
|
|
974
|
+
|
|
890
975
|
/**
|
|
891
976
|
* Model shortcuts and aliases for more expressive DX.
|
|
892
977
|
*
|
|
@@ -1107,6 +1192,24 @@ interface CreateGadgetConfig<TSchema extends ZodType> {
|
|
|
1107
1192
|
*/
|
|
1108
1193
|
declare function createGadget<TSchema extends ZodType>(config: CreateGadgetConfig<TSchema>): BaseGadget;
|
|
1109
1194
|
|
|
1195
|
+
/**
|
|
1196
|
+
* Create a GadgetOutputViewer gadget instance bound to a specific output store.
|
|
1197
|
+
*
|
|
1198
|
+
* This is a factory function because the gadget needs access to the output store,
|
|
1199
|
+
* which is created per-agent-run.
|
|
1200
|
+
*
|
|
1201
|
+
* @param store - The GadgetOutputStore to read outputs from
|
|
1202
|
+
* @returns A GadgetOutputViewer gadget instance
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* ```typescript
|
|
1206
|
+
* const store = new GadgetOutputStore();
|
|
1207
|
+
* const viewer = createGadgetOutputViewer(store);
|
|
1208
|
+
* registry.register("GadgetOutputViewer", viewer);
|
|
1209
|
+
* ```
|
|
1210
|
+
*/
|
|
1211
|
+
declare function createGadgetOutputViewer(store: GadgetOutputStore): BaseGadget;
|
|
1212
|
+
|
|
1110
1213
|
/**
|
|
1111
1214
|
* Exception that gadgets can throw to signal the agent loop should terminate.
|
|
1112
1215
|
*
|
|
@@ -1407,6 +1510,12 @@ interface LoggerOptions {
|
|
|
1407
1510
|
* Logger name (appears in logs)
|
|
1408
1511
|
*/
|
|
1409
1512
|
name?: string;
|
|
1513
|
+
/**
|
|
1514
|
+
* When true, reset (truncate) the log file instead of appending.
|
|
1515
|
+
* Useful for getting clean logs per session.
|
|
1516
|
+
* @default false
|
|
1517
|
+
*/
|
|
1518
|
+
logReset?: boolean;
|
|
1410
1519
|
}
|
|
1411
1520
|
/**
|
|
1412
1521
|
* Create a new logger instance for the library.
|
|
@@ -1660,4 +1769,4 @@ declare class OpenAIChatProvider extends BaseProviderAdapter {
|
|
|
1660
1769
|
}
|
|
1661
1770
|
declare function createOpenAIProviderFromEnv(): OpenAIChatProvider | null;
|
|
1662
1771
|
|
|
1663
|
-
export { AgentHooks, AnthropicMessagesProvider, BaseGadget, BreakLoopException, ConversationManager, type CreateGadgetConfig, Gadget, type GadgetConfig, GadgetExample, GadgetExecutionResult, GadgetExecutor, GadgetRegistry, GeminiGenerativeProvider, HookPresets, HumanInputException, type IConversationManager, LLMGenerationOptions, LLMMessage, LLMStream, LLMStreamChunk, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, ModelDescriptor, ModelRegistry, ModelSpec, OpenAIChatProvider, ParsedGadgetCall, ProviderAdapter, StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, type ValidationIssue, type ValidationResult, createAnthropicProviderFromEnv, createGadget, createGeminiProviderFromEnv, createLogger, createOpenAIProviderFromEnv, defaultLogger, discoverProviderAdapters, getModelId, getProvider, hasProviderPrefix, resolveModel, validateAndApplyDefaults, validateGadgetParams };
|
|
1772
|
+
export { AgentHooks, AnthropicMessagesProvider, BaseGadget, BreakLoopException, ConversationManager, type CreateGadgetConfig, Gadget, type GadgetConfig, GadgetExample, GadgetExecutionResult, GadgetExecutor, GadgetOutputStore, GadgetRegistry, GeminiGenerativeProvider, HookPresets, HumanInputException, type IConversationManager, LLMGenerationOptions, LLMMessage, LLMStream, LLMStreamChunk, type LoggerOptions, type LoggingOptions, MODEL_ALIASES, ModelDescriptor, ModelRegistry, ModelSpec, OpenAIChatProvider, ParsedGadgetCall, ProviderAdapter, type StoredOutput, StreamEvent, type StreamProcessingResult, StreamProcessor, type StreamProcessorOptions, type ValidationIssue, type ValidationResult, createAnthropicProviderFromEnv, createGadget, createGadgetOutputViewer, createGeminiProviderFromEnv, createLogger, createOpenAIProviderFromEnv, defaultLogger, discoverProviderAdapters, getModelId, getProvider, hasProviderPrefix, resolveModel, validateAndApplyDefaults, validateGadgetParams };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createGadget
|
|
3
|
-
} from "./chunk-LKIBXQ5I.js";
|
|
4
1
|
import {
|
|
5
2
|
MockBuilder,
|
|
6
3
|
MockManager,
|
|
@@ -13,7 +10,7 @@ import {
|
|
|
13
10
|
mockLLM,
|
|
14
11
|
validateAndApplyDefaults,
|
|
15
12
|
validateGadgetParams
|
|
16
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YWJSGEYT.js";
|
|
17
14
|
import {
|
|
18
15
|
AgentBuilder,
|
|
19
16
|
AnthropicMessagesProvider,
|
|
@@ -22,6 +19,7 @@ import {
|
|
|
22
19
|
ConversationManager,
|
|
23
20
|
DEFAULT_PROMPTS,
|
|
24
21
|
GadgetExecutor,
|
|
22
|
+
GadgetOutputStore,
|
|
25
23
|
GadgetRegistry,
|
|
26
24
|
GeminiGenerativeProvider,
|
|
27
25
|
HumanInputException,
|
|
@@ -37,6 +35,8 @@ import {
|
|
|
37
35
|
collectText,
|
|
38
36
|
complete,
|
|
39
37
|
createAnthropicProviderFromEnv,
|
|
38
|
+
createGadget,
|
|
39
|
+
createGadgetOutputViewer,
|
|
40
40
|
createGeminiProviderFromEnv,
|
|
41
41
|
createLogger,
|
|
42
42
|
createOpenAIProviderFromEnv,
|
|
@@ -49,10 +49,13 @@ import {
|
|
|
49
49
|
init_builder,
|
|
50
50
|
init_client,
|
|
51
51
|
init_conversation_manager,
|
|
52
|
+
init_create_gadget,
|
|
52
53
|
init_discovery,
|
|
53
54
|
init_event_handlers,
|
|
54
55
|
init_exceptions,
|
|
55
56
|
init_executor,
|
|
57
|
+
init_gadget,
|
|
58
|
+
init_gadget_output_store,
|
|
56
59
|
init_gemini,
|
|
57
60
|
init_logger,
|
|
58
61
|
init_messages,
|
|
@@ -60,6 +63,7 @@ import {
|
|
|
60
63
|
init_model_shortcuts,
|
|
61
64
|
init_openai,
|
|
62
65
|
init_options,
|
|
66
|
+
init_output_viewer,
|
|
63
67
|
init_parser,
|
|
64
68
|
init_prompt_config,
|
|
65
69
|
init_quick_methods,
|
|
@@ -70,7 +74,7 @@ import {
|
|
|
70
74
|
resolveRulesTemplate,
|
|
71
75
|
runWithHandlers,
|
|
72
76
|
stream
|
|
73
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-KB7LMYC2.js";
|
|
74
78
|
|
|
75
79
|
// src/index.ts
|
|
76
80
|
init_builder();
|
|
@@ -805,6 +809,7 @@ var HookPresets = class _HookPresets {
|
|
|
805
809
|
// src/agent/index.ts
|
|
806
810
|
init_conversation_manager();
|
|
807
811
|
init_stream_processor();
|
|
812
|
+
init_gadget_output_store();
|
|
808
813
|
|
|
809
814
|
// src/index.ts
|
|
810
815
|
init_client();
|
|
@@ -814,12 +819,16 @@ init_model_shortcuts();
|
|
|
814
819
|
init_options();
|
|
815
820
|
init_prompt_config();
|
|
816
821
|
init_quick_methods();
|
|
822
|
+
init_create_gadget();
|
|
823
|
+
init_output_viewer();
|
|
817
824
|
init_exceptions();
|
|
818
825
|
init_executor();
|
|
826
|
+
init_gadget();
|
|
819
827
|
init_parser();
|
|
820
828
|
init_registry();
|
|
821
829
|
|
|
822
830
|
// src/gadgets/typed-gadget.ts
|
|
831
|
+
init_gadget();
|
|
823
832
|
function Gadget(config) {
|
|
824
833
|
class GadgetBase extends BaseGadget {
|
|
825
834
|
description = config.description;
|
|
@@ -854,6 +863,7 @@ export {
|
|
|
854
863
|
DEFAULT_PROMPTS,
|
|
855
864
|
Gadget,
|
|
856
865
|
GadgetExecutor,
|
|
866
|
+
GadgetOutputStore,
|
|
857
867
|
GadgetRegistry,
|
|
858
868
|
GeminiGenerativeProvider,
|
|
859
869
|
HookPresets,
|
|
@@ -874,6 +884,7 @@ export {
|
|
|
874
884
|
complete,
|
|
875
885
|
createAnthropicProviderFromEnv,
|
|
876
886
|
createGadget,
|
|
887
|
+
createGadgetOutputViewer,
|
|
877
888
|
createGeminiProviderFromEnv,
|
|
878
889
|
createLogger,
|
|
879
890
|
createMockAdapter,
|