llmist 16.0.3 → 16.0.4
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/index.cjs +816 -576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -64
- package/dist/index.d.ts +20 -64
- package/dist/index.js +816 -576
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2058,12 +2058,13 @@ interface Interceptors {
|
|
|
2058
2058
|
*/
|
|
2059
2059
|
interceptGadgetParameters?: (parameters: Readonly<Record<string, unknown>>, context: GadgetParameterInterceptorContext) => Record<string, unknown>;
|
|
2060
2060
|
/**
|
|
2061
|
-
* Intercept and transform gadget results after execution.
|
|
2061
|
+
* Intercept and transform gadget results and error messages after execution.
|
|
2062
2062
|
* This affects what gets sent back to the LLM and stored in history.
|
|
2063
|
+
* Called for both successful results (result.result) and errors (result.error).
|
|
2063
2064
|
*
|
|
2064
|
-
* @param result - The gadget result text
|
|
2065
|
+
* @param result - The gadget result or error text
|
|
2065
2066
|
* @param context - Context information including parameters and execution time
|
|
2066
|
-
* @returns Transformed
|
|
2067
|
+
* @returns Transformed text (cannot be suppressed)
|
|
2067
2068
|
*/
|
|
2068
2069
|
interceptGadgetResult?: (result: string, context: GadgetResultInterceptorContext) => string;
|
|
2069
2070
|
}
|
|
@@ -5519,7 +5520,9 @@ declare class AgentBuilder {
|
|
|
5519
5520
|
*/
|
|
5520
5521
|
/**
|
|
5521
5522
|
* Build AgentOptions with the given user prompt.
|
|
5522
|
-
* Centralizes options construction for ask(), askWithImage(), and
|
|
5523
|
+
* Centralizes options construction for ask(), askWithImage(), askWithContent(), and build().
|
|
5524
|
+
*
|
|
5525
|
+
* @param userPrompt - Optional user prompt (omitted for build() which has no prompt)
|
|
5523
5526
|
*/
|
|
5524
5527
|
private buildAgentOptions;
|
|
5525
5528
|
ask(userPrompt: string): Agent;
|
|
@@ -6633,10 +6636,6 @@ declare class Agent {
|
|
|
6633
6636
|
* Handle text-only response (no gadgets called).
|
|
6634
6637
|
*/
|
|
6635
6638
|
private handleTextOnlyResponse;
|
|
6636
|
-
/**
|
|
6637
|
-
* Safely execute an observer, catching and logging any errors.
|
|
6638
|
-
*/
|
|
6639
|
-
private safeObserve;
|
|
6640
6639
|
/**
|
|
6641
6640
|
* Resolve max tokens from model catalog.
|
|
6642
6641
|
*/
|
|
@@ -7143,6 +7142,8 @@ declare class HookPresets {
|
|
|
7143
7142
|
/**
|
|
7144
7143
|
* Tracks cumulative token usage across all LLM calls.
|
|
7145
7144
|
*
|
|
7145
|
+
* @public
|
|
7146
|
+
*
|
|
7146
7147
|
* **Output:**
|
|
7147
7148
|
* - Per-call token count with 📊 emoji
|
|
7148
7149
|
* - Cumulative total across all calls
|
|
@@ -7320,6 +7321,8 @@ declare class HookPresets {
|
|
|
7320
7321
|
/**
|
|
7321
7322
|
* Logs detailed error information for debugging and troubleshooting.
|
|
7322
7323
|
*
|
|
7324
|
+
* @public
|
|
7325
|
+
*
|
|
7323
7326
|
* **Output:**
|
|
7324
7327
|
* - LLM errors with ❌ emoji, including model and recovery status
|
|
7325
7328
|
* - Gadget errors with full context (parameters, error message)
|
|
@@ -7381,6 +7384,8 @@ declare class HookPresets {
|
|
|
7381
7384
|
/**
|
|
7382
7385
|
* Tracks context compaction events.
|
|
7383
7386
|
*
|
|
7387
|
+
* @public
|
|
7388
|
+
*
|
|
7384
7389
|
* **Output:**
|
|
7385
7390
|
* - Compaction events with 🗜️ emoji
|
|
7386
7391
|
* - Strategy name, tokens before/after, and savings
|
|
@@ -7474,6 +7479,8 @@ declare class HookPresets {
|
|
|
7474
7479
|
/**
|
|
7475
7480
|
* Returns empty hook configuration for clean output without any logging.
|
|
7476
7481
|
*
|
|
7482
|
+
* @public
|
|
7483
|
+
*
|
|
7477
7484
|
* **Output:**
|
|
7478
7485
|
* - None. Returns {} (empty object).
|
|
7479
7486
|
*
|
|
@@ -7600,6 +7607,8 @@ declare class HookPresets {
|
|
|
7600
7607
|
/**
|
|
7601
7608
|
* Composite preset combining logging, timing, tokenTracking, and errorLogging.
|
|
7602
7609
|
*
|
|
7610
|
+
* @public
|
|
7611
|
+
*
|
|
7603
7612
|
* This is the recommended preset for development and initial production deployments,
|
|
7604
7613
|
* providing comprehensive observability with a single method call.
|
|
7605
7614
|
*
|
|
@@ -8213,7 +8222,6 @@ interface StreamProcessingResult {
|
|
|
8213
8222
|
*/
|
|
8214
8223
|
declare class StreamProcessor {
|
|
8215
8224
|
private readonly iteration;
|
|
8216
|
-
private readonly registry;
|
|
8217
8225
|
private readonly hooks;
|
|
8218
8226
|
private readonly logger;
|
|
8219
8227
|
private readonly parser;
|
|
@@ -8223,29 +8231,10 @@ declare class StreamProcessor {
|
|
|
8223
8231
|
private readonly baseDepth;
|
|
8224
8232
|
private readonly gadgetExecutionMode;
|
|
8225
8233
|
private responseText;
|
|
8226
|
-
private
|
|
8227
|
-
|
|
8228
|
-
private gadgetsAwaitingDependencies;
|
|
8229
|
-
/** Completed gadget results, keyed by invocation ID */
|
|
8230
|
-
private completedResults;
|
|
8231
|
-
/** Invocation IDs of gadgets that have failed (error or skipped due to dependency) */
|
|
8232
|
-
private failedInvocations;
|
|
8233
|
-
/** Promises for independent gadgets currently executing (fire-and-forget) */
|
|
8234
|
-
private inFlightExecutions;
|
|
8234
|
+
private readonly dependencyResolver;
|
|
8235
|
+
private readonly concurrencyManager;
|
|
8235
8236
|
/** Queue of completed gadget results ready to be yielded (for real-time streaming) */
|
|
8236
8237
|
private completedResultsQueue;
|
|
8237
|
-
/** Subagent configuration map for checking maxConcurrent limits */
|
|
8238
|
-
private readonly subagentConfig?;
|
|
8239
|
-
/** Track active execution count per gadget name */
|
|
8240
|
-
private activeCountByGadget;
|
|
8241
|
-
/** Queue of gadgets waiting for a concurrency slot (per gadget name) */
|
|
8242
|
-
private concurrencyQueue;
|
|
8243
|
-
/** Queue of exclusive gadgets deferred until in-flight gadgets complete */
|
|
8244
|
-
private exclusiveQueue;
|
|
8245
|
-
/** Invocation IDs completed in previous iterations (read-only reference from Agent) */
|
|
8246
|
-
private readonly priorCompletedInvocations;
|
|
8247
|
-
/** Invocation IDs that failed in previous iterations (read-only reference from Agent) */
|
|
8248
|
-
private readonly priorFailedInvocations;
|
|
8249
8238
|
private readonly parentObservers?;
|
|
8250
8239
|
private readonly maxGadgetsPerResponse;
|
|
8251
8240
|
private gadgetStartedCount;
|
|
@@ -8277,26 +8266,11 @@ declare class StreamProcessor {
|
|
|
8277
8266
|
* enabling real-time UI feedback.
|
|
8278
8267
|
*/
|
|
8279
8268
|
private processGadgetCallGenerator;
|
|
8280
|
-
/**
|
|
8281
|
-
* Get the effective concurrency limit for a gadget.
|
|
8282
|
-
* Uses "most restrictive wins" strategy: the lowest non-zero value from
|
|
8283
|
-
* external config (SubagentConfig) and gadget's intrinsic maxConcurrent.
|
|
8284
|
-
*
|
|
8285
|
-
* This ensures gadget authors can set safety floors (e.g., maxConcurrent: 1
|
|
8286
|
-
* for file writers) that cannot be weakened by external configuration.
|
|
8287
|
-
*
|
|
8288
|
-
* @returns 0 if unlimited, otherwise the effective limit
|
|
8289
|
-
*/
|
|
8290
|
-
private getConcurrencyLimit;
|
|
8291
8269
|
/**
|
|
8292
8270
|
* Start a gadget execution with concurrency tracking.
|
|
8293
|
-
*
|
|
8271
|
+
* Delegates tracking to GadgetConcurrencyManager; schedules queue processing on completion.
|
|
8294
8272
|
*/
|
|
8295
8273
|
private startGadgetWithConcurrencyTracking;
|
|
8296
|
-
/**
|
|
8297
|
-
* Process the next queued gadget for a given gadget name if a slot is available.
|
|
8298
|
-
*/
|
|
8299
|
-
private processQueuedGadget;
|
|
8300
8274
|
/**
|
|
8301
8275
|
* Execute a gadget through the full hook lifecycle and yield events.
|
|
8302
8276
|
* Handles parameter interception, before/after controllers, observers,
|
|
@@ -8324,19 +8298,6 @@ declare class StreamProcessor {
|
|
|
8324
8298
|
* Clears the inFlightExecutions map after all gadgets complete.
|
|
8325
8299
|
*/
|
|
8326
8300
|
private waitForInFlightExecutions;
|
|
8327
|
-
/**
|
|
8328
|
-
* Check if there are any gadgets waiting in concurrency queues.
|
|
8329
|
-
*/
|
|
8330
|
-
private hasQueuedGadgets;
|
|
8331
|
-
/**
|
|
8332
|
-
* Get total count of queued gadgets across all queues.
|
|
8333
|
-
*/
|
|
8334
|
-
private getQueuedGadgetCount;
|
|
8335
|
-
/**
|
|
8336
|
-
* Get total count of actively executing gadgets across all types.
|
|
8337
|
-
* Used to know when all work is truly complete (not just when allDone resolves).
|
|
8338
|
-
*/
|
|
8339
|
-
private getTotalActiveGadgetCount;
|
|
8340
8301
|
/**
|
|
8341
8302
|
* Handle a gadget that cannot execute because a dependency failed.
|
|
8342
8303
|
* Calls the onDependencySkipped controller to allow customization.
|
|
@@ -8358,11 +8319,6 @@ declare class StreamProcessor {
|
|
|
8358
8319
|
* but results are yielded as they become available.
|
|
8359
8320
|
*/
|
|
8360
8321
|
private processPendingGadgetsGenerator;
|
|
8361
|
-
/**
|
|
8362
|
-
* Safely execute an observer, catching and logging any errors.
|
|
8363
|
-
* Observers are non-critical, so errors are logged but don't crash the system.
|
|
8364
|
-
*/
|
|
8365
|
-
private safeObserve;
|
|
8366
8322
|
/**
|
|
8367
8323
|
* Execute multiple observers in parallel.
|
|
8368
8324
|
* All observers run concurrently and failures are tracked but don't crash.
|
package/dist/index.d.ts
CHANGED
|
@@ -2058,12 +2058,13 @@ interface Interceptors {
|
|
|
2058
2058
|
*/
|
|
2059
2059
|
interceptGadgetParameters?: (parameters: Readonly<Record<string, unknown>>, context: GadgetParameterInterceptorContext) => Record<string, unknown>;
|
|
2060
2060
|
/**
|
|
2061
|
-
* Intercept and transform gadget results after execution.
|
|
2061
|
+
* Intercept and transform gadget results and error messages after execution.
|
|
2062
2062
|
* This affects what gets sent back to the LLM and stored in history.
|
|
2063
|
+
* Called for both successful results (result.result) and errors (result.error).
|
|
2063
2064
|
*
|
|
2064
|
-
* @param result - The gadget result text
|
|
2065
|
+
* @param result - The gadget result or error text
|
|
2065
2066
|
* @param context - Context information including parameters and execution time
|
|
2066
|
-
* @returns Transformed
|
|
2067
|
+
* @returns Transformed text (cannot be suppressed)
|
|
2067
2068
|
*/
|
|
2068
2069
|
interceptGadgetResult?: (result: string, context: GadgetResultInterceptorContext) => string;
|
|
2069
2070
|
}
|
|
@@ -5519,7 +5520,9 @@ declare class AgentBuilder {
|
|
|
5519
5520
|
*/
|
|
5520
5521
|
/**
|
|
5521
5522
|
* Build AgentOptions with the given user prompt.
|
|
5522
|
-
* Centralizes options construction for ask(), askWithImage(), and
|
|
5523
|
+
* Centralizes options construction for ask(), askWithImage(), askWithContent(), and build().
|
|
5524
|
+
*
|
|
5525
|
+
* @param userPrompt - Optional user prompt (omitted for build() which has no prompt)
|
|
5523
5526
|
*/
|
|
5524
5527
|
private buildAgentOptions;
|
|
5525
5528
|
ask(userPrompt: string): Agent;
|
|
@@ -6633,10 +6636,6 @@ declare class Agent {
|
|
|
6633
6636
|
* Handle text-only response (no gadgets called).
|
|
6634
6637
|
*/
|
|
6635
6638
|
private handleTextOnlyResponse;
|
|
6636
|
-
/**
|
|
6637
|
-
* Safely execute an observer, catching and logging any errors.
|
|
6638
|
-
*/
|
|
6639
|
-
private safeObserve;
|
|
6640
6639
|
/**
|
|
6641
6640
|
* Resolve max tokens from model catalog.
|
|
6642
6641
|
*/
|
|
@@ -7143,6 +7142,8 @@ declare class HookPresets {
|
|
|
7143
7142
|
/**
|
|
7144
7143
|
* Tracks cumulative token usage across all LLM calls.
|
|
7145
7144
|
*
|
|
7145
|
+
* @public
|
|
7146
|
+
*
|
|
7146
7147
|
* **Output:**
|
|
7147
7148
|
* - Per-call token count with 📊 emoji
|
|
7148
7149
|
* - Cumulative total across all calls
|
|
@@ -7320,6 +7321,8 @@ declare class HookPresets {
|
|
|
7320
7321
|
/**
|
|
7321
7322
|
* Logs detailed error information for debugging and troubleshooting.
|
|
7322
7323
|
*
|
|
7324
|
+
* @public
|
|
7325
|
+
*
|
|
7323
7326
|
* **Output:**
|
|
7324
7327
|
* - LLM errors with ❌ emoji, including model and recovery status
|
|
7325
7328
|
* - Gadget errors with full context (parameters, error message)
|
|
@@ -7381,6 +7384,8 @@ declare class HookPresets {
|
|
|
7381
7384
|
/**
|
|
7382
7385
|
* Tracks context compaction events.
|
|
7383
7386
|
*
|
|
7387
|
+
* @public
|
|
7388
|
+
*
|
|
7384
7389
|
* **Output:**
|
|
7385
7390
|
* - Compaction events with 🗜️ emoji
|
|
7386
7391
|
* - Strategy name, tokens before/after, and savings
|
|
@@ -7474,6 +7479,8 @@ declare class HookPresets {
|
|
|
7474
7479
|
/**
|
|
7475
7480
|
* Returns empty hook configuration for clean output without any logging.
|
|
7476
7481
|
*
|
|
7482
|
+
* @public
|
|
7483
|
+
*
|
|
7477
7484
|
* **Output:**
|
|
7478
7485
|
* - None. Returns {} (empty object).
|
|
7479
7486
|
*
|
|
@@ -7600,6 +7607,8 @@ declare class HookPresets {
|
|
|
7600
7607
|
/**
|
|
7601
7608
|
* Composite preset combining logging, timing, tokenTracking, and errorLogging.
|
|
7602
7609
|
*
|
|
7610
|
+
* @public
|
|
7611
|
+
*
|
|
7603
7612
|
* This is the recommended preset for development and initial production deployments,
|
|
7604
7613
|
* providing comprehensive observability with a single method call.
|
|
7605
7614
|
*
|
|
@@ -8213,7 +8222,6 @@ interface StreamProcessingResult {
|
|
|
8213
8222
|
*/
|
|
8214
8223
|
declare class StreamProcessor {
|
|
8215
8224
|
private readonly iteration;
|
|
8216
|
-
private readonly registry;
|
|
8217
8225
|
private readonly hooks;
|
|
8218
8226
|
private readonly logger;
|
|
8219
8227
|
private readonly parser;
|
|
@@ -8223,29 +8231,10 @@ declare class StreamProcessor {
|
|
|
8223
8231
|
private readonly baseDepth;
|
|
8224
8232
|
private readonly gadgetExecutionMode;
|
|
8225
8233
|
private responseText;
|
|
8226
|
-
private
|
|
8227
|
-
|
|
8228
|
-
private gadgetsAwaitingDependencies;
|
|
8229
|
-
/** Completed gadget results, keyed by invocation ID */
|
|
8230
|
-
private completedResults;
|
|
8231
|
-
/** Invocation IDs of gadgets that have failed (error or skipped due to dependency) */
|
|
8232
|
-
private failedInvocations;
|
|
8233
|
-
/** Promises for independent gadgets currently executing (fire-and-forget) */
|
|
8234
|
-
private inFlightExecutions;
|
|
8234
|
+
private readonly dependencyResolver;
|
|
8235
|
+
private readonly concurrencyManager;
|
|
8235
8236
|
/** Queue of completed gadget results ready to be yielded (for real-time streaming) */
|
|
8236
8237
|
private completedResultsQueue;
|
|
8237
|
-
/** Subagent configuration map for checking maxConcurrent limits */
|
|
8238
|
-
private readonly subagentConfig?;
|
|
8239
|
-
/** Track active execution count per gadget name */
|
|
8240
|
-
private activeCountByGadget;
|
|
8241
|
-
/** Queue of gadgets waiting for a concurrency slot (per gadget name) */
|
|
8242
|
-
private concurrencyQueue;
|
|
8243
|
-
/** Queue of exclusive gadgets deferred until in-flight gadgets complete */
|
|
8244
|
-
private exclusiveQueue;
|
|
8245
|
-
/** Invocation IDs completed in previous iterations (read-only reference from Agent) */
|
|
8246
|
-
private readonly priorCompletedInvocations;
|
|
8247
|
-
/** Invocation IDs that failed in previous iterations (read-only reference from Agent) */
|
|
8248
|
-
private readonly priorFailedInvocations;
|
|
8249
8238
|
private readonly parentObservers?;
|
|
8250
8239
|
private readonly maxGadgetsPerResponse;
|
|
8251
8240
|
private gadgetStartedCount;
|
|
@@ -8277,26 +8266,11 @@ declare class StreamProcessor {
|
|
|
8277
8266
|
* enabling real-time UI feedback.
|
|
8278
8267
|
*/
|
|
8279
8268
|
private processGadgetCallGenerator;
|
|
8280
|
-
/**
|
|
8281
|
-
* Get the effective concurrency limit for a gadget.
|
|
8282
|
-
* Uses "most restrictive wins" strategy: the lowest non-zero value from
|
|
8283
|
-
* external config (SubagentConfig) and gadget's intrinsic maxConcurrent.
|
|
8284
|
-
*
|
|
8285
|
-
* This ensures gadget authors can set safety floors (e.g., maxConcurrent: 1
|
|
8286
|
-
* for file writers) that cannot be weakened by external configuration.
|
|
8287
|
-
*
|
|
8288
|
-
* @returns 0 if unlimited, otherwise the effective limit
|
|
8289
|
-
*/
|
|
8290
|
-
private getConcurrencyLimit;
|
|
8291
8269
|
/**
|
|
8292
8270
|
* Start a gadget execution with concurrency tracking.
|
|
8293
|
-
*
|
|
8271
|
+
* Delegates tracking to GadgetConcurrencyManager; schedules queue processing on completion.
|
|
8294
8272
|
*/
|
|
8295
8273
|
private startGadgetWithConcurrencyTracking;
|
|
8296
|
-
/**
|
|
8297
|
-
* Process the next queued gadget for a given gadget name if a slot is available.
|
|
8298
|
-
*/
|
|
8299
|
-
private processQueuedGadget;
|
|
8300
8274
|
/**
|
|
8301
8275
|
* Execute a gadget through the full hook lifecycle and yield events.
|
|
8302
8276
|
* Handles parameter interception, before/after controllers, observers,
|
|
@@ -8324,19 +8298,6 @@ declare class StreamProcessor {
|
|
|
8324
8298
|
* Clears the inFlightExecutions map after all gadgets complete.
|
|
8325
8299
|
*/
|
|
8326
8300
|
private waitForInFlightExecutions;
|
|
8327
|
-
/**
|
|
8328
|
-
* Check if there are any gadgets waiting in concurrency queues.
|
|
8329
|
-
*/
|
|
8330
|
-
private hasQueuedGadgets;
|
|
8331
|
-
/**
|
|
8332
|
-
* Get total count of queued gadgets across all queues.
|
|
8333
|
-
*/
|
|
8334
|
-
private getQueuedGadgetCount;
|
|
8335
|
-
/**
|
|
8336
|
-
* Get total count of actively executing gadgets across all types.
|
|
8337
|
-
* Used to know when all work is truly complete (not just when allDone resolves).
|
|
8338
|
-
*/
|
|
8339
|
-
private getTotalActiveGadgetCount;
|
|
8340
8301
|
/**
|
|
8341
8302
|
* Handle a gadget that cannot execute because a dependency failed.
|
|
8342
8303
|
* Calls the onDependencySkipped controller to allow customization.
|
|
@@ -8358,11 +8319,6 @@ declare class StreamProcessor {
|
|
|
8358
8319
|
* but results are yielded as they become available.
|
|
8359
8320
|
*/
|
|
8360
8321
|
private processPendingGadgetsGenerator;
|
|
8361
|
-
/**
|
|
8362
|
-
* Safely execute an observer, catching and logging any errors.
|
|
8363
|
-
* Observers are non-critical, so errors are logged but don't crash the system.
|
|
8364
|
-
*/
|
|
8365
|
-
private safeObserve;
|
|
8366
8322
|
/**
|
|
8367
8323
|
* Execute multiple observers in parallel.
|
|
8368
8324
|
* All observers run concurrently and failures are tracked but don't crash.
|