@kenkaiiii/gg-agent 5.95.2 → 5.95.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.d.cts CHANGED
@@ -524,6 +524,16 @@ declare class Agent {
524
524
  prompt(content: string): AgentStream;
525
525
  }
526
526
 
527
+ /**
528
+ * Instant interrupt: once a steering message preempts a tool batch, an
529
+ * interruptible tool that ignores its AbortSignal gets this long to settle
530
+ * before the loop records it as interrupted and moves on without it.
531
+ */
532
+ declare const PREEMPT_GRACE_MS = 500;
533
+ /** Result text for a tool call cut short by a mid-run steering message. */
534
+ declare const STEER_INTERRUPTED_TEXT = "Interrupted: the user sent a new message.";
535
+ declare function isInterruptibleTool(tool: AgentTool | undefined, name: string): boolean;
536
+ declare function markSteerInterrupted(record: ToolExecutionRecord): ToolExecutionRecord;
527
537
  /**
528
538
  * Lightweight stream diagnostic callback. When set, the agent loop calls this
529
539
  * at every phase boundary with timing and state info. This lets the hosting
@@ -559,6 +569,13 @@ declare function isBillingError(err: unknown): boolean;
559
569
  */
560
570
  declare function isUsageLimitError(err: unknown): boolean;
561
571
  declare function agentLoop(messages: Message[], options: AgentOptions): AsyncGenerator<AgentEvent, AgentResult>;
572
+ interface ToolExecutionRecord {
573
+ toolCallId: string;
574
+ content: ToolResultContent;
575
+ isError: boolean;
576
+ endRun?: boolean;
577
+ loadedTools?: string[];
578
+ }
562
579
  /**
563
580
  * A tool call that never reached its tool. Nothing ran, so nothing changed.
564
581
  */
@@ -595,4 +612,4 @@ declare function unknownToolMessage(name: string, available: readonly string[]):
595
612
  */
596
613
  declare function argumentHints(tool: AgentTool, args: unknown): string;
597
614
 
598
- export { Agent, type AgentDoneEvent, type AgentErrorEvent, type AgentEvent, type AgentFollowUpMessageEvent, type AgentOptions, type AgentResult, type AgentRetryEvent, type AgentServerToolCallEvent, type AgentServerToolResultEvent, type AgentSteeringMessageEvent, AgentStream, type AgentStreamRuleTriggeredEvent, type AgentTextDeltaEvent, type AgentThinkingDeltaEvent, type AgentTool, type AgentToolCallDeltaEvent, type AgentToolCallEndEvent, type AgentToolCallStartEvent, type AgentToolCallUpdateEvent, type AgentTurnEndEvent, type AgentTurnTiming, DEFAULT_STREAM_RULE_MAX_RETRIES, DEFAULT_STREAM_RULE_WINDOW_CHARS, JsonEscapeDecoder, type StreamDiagnosticFn, type StreamRule, type StreamRuleMatch, StreamRuleMonitor, type StreamRuleScope, type StreamRuleSource, type StreamRulesConfig, type StructuredToolResult, type ToolContext, type ToolExecuteResult, type ToolExecutionMode, type TransformContextOptions, agentLoop, argumentHints, buildStreamRuleReminder, cancelledBeforeStartText, capToolResults, indeterminateOutcomeText, isAbortError, isBillingError, isContextOverflow, isLocalBackendUrl, isUsageLimitError, repairToolPairingAdjacent, setStreamDiagnostic, unknownToolMessage };
615
+ export { Agent, type AgentDoneEvent, type AgentErrorEvent, type AgentEvent, type AgentFollowUpMessageEvent, type AgentOptions, type AgentResult, type AgentRetryEvent, type AgentServerToolCallEvent, type AgentServerToolResultEvent, type AgentSteeringMessageEvent, AgentStream, type AgentStreamRuleTriggeredEvent, type AgentTextDeltaEvent, type AgentThinkingDeltaEvent, type AgentTool, type AgentToolCallDeltaEvent, type AgentToolCallEndEvent, type AgentToolCallStartEvent, type AgentToolCallUpdateEvent, type AgentTurnEndEvent, type AgentTurnTiming, DEFAULT_STREAM_RULE_MAX_RETRIES, DEFAULT_STREAM_RULE_WINDOW_CHARS, JsonEscapeDecoder, PREEMPT_GRACE_MS, STEER_INTERRUPTED_TEXT, type StreamDiagnosticFn, type StreamRule, type StreamRuleMatch, StreamRuleMonitor, type StreamRuleScope, type StreamRuleSource, type StreamRulesConfig, type StructuredToolResult, type ToolContext, type ToolExecuteResult, type ToolExecutionMode, type TransformContextOptions, agentLoop, argumentHints, buildStreamRuleReminder, cancelledBeforeStartText, capToolResults, indeterminateOutcomeText, isAbortError, isBillingError, isContextOverflow, isInterruptibleTool, isLocalBackendUrl, isUsageLimitError, markSteerInterrupted, repairToolPairingAdjacent, setStreamDiagnostic, unknownToolMessage };
package/dist/index.d.ts CHANGED
@@ -524,6 +524,16 @@ declare class Agent {
524
524
  prompt(content: string): AgentStream;
525
525
  }
526
526
 
527
+ /**
528
+ * Instant interrupt: once a steering message preempts a tool batch, an
529
+ * interruptible tool that ignores its AbortSignal gets this long to settle
530
+ * before the loop records it as interrupted and moves on without it.
531
+ */
532
+ declare const PREEMPT_GRACE_MS = 500;
533
+ /** Result text for a tool call cut short by a mid-run steering message. */
534
+ declare const STEER_INTERRUPTED_TEXT = "Interrupted: the user sent a new message.";
535
+ declare function isInterruptibleTool(tool: AgentTool | undefined, name: string): boolean;
536
+ declare function markSteerInterrupted(record: ToolExecutionRecord): ToolExecutionRecord;
527
537
  /**
528
538
  * Lightweight stream diagnostic callback. When set, the agent loop calls this
529
539
  * at every phase boundary with timing and state info. This lets the hosting
@@ -559,6 +569,13 @@ declare function isBillingError(err: unknown): boolean;
559
569
  */
560
570
  declare function isUsageLimitError(err: unknown): boolean;
561
571
  declare function agentLoop(messages: Message[], options: AgentOptions): AsyncGenerator<AgentEvent, AgentResult>;
572
+ interface ToolExecutionRecord {
573
+ toolCallId: string;
574
+ content: ToolResultContent;
575
+ isError: boolean;
576
+ endRun?: boolean;
577
+ loadedTools?: string[];
578
+ }
562
579
  /**
563
580
  * A tool call that never reached its tool. Nothing ran, so nothing changed.
564
581
  */
@@ -595,4 +612,4 @@ declare function unknownToolMessage(name: string, available: readonly string[]):
595
612
  */
596
613
  declare function argumentHints(tool: AgentTool, args: unknown): string;
597
614
 
598
- export { Agent, type AgentDoneEvent, type AgentErrorEvent, type AgentEvent, type AgentFollowUpMessageEvent, type AgentOptions, type AgentResult, type AgentRetryEvent, type AgentServerToolCallEvent, type AgentServerToolResultEvent, type AgentSteeringMessageEvent, AgentStream, type AgentStreamRuleTriggeredEvent, type AgentTextDeltaEvent, type AgentThinkingDeltaEvent, type AgentTool, type AgentToolCallDeltaEvent, type AgentToolCallEndEvent, type AgentToolCallStartEvent, type AgentToolCallUpdateEvent, type AgentTurnEndEvent, type AgentTurnTiming, DEFAULT_STREAM_RULE_MAX_RETRIES, DEFAULT_STREAM_RULE_WINDOW_CHARS, JsonEscapeDecoder, type StreamDiagnosticFn, type StreamRule, type StreamRuleMatch, StreamRuleMonitor, type StreamRuleScope, type StreamRuleSource, type StreamRulesConfig, type StructuredToolResult, type ToolContext, type ToolExecuteResult, type ToolExecutionMode, type TransformContextOptions, agentLoop, argumentHints, buildStreamRuleReminder, cancelledBeforeStartText, capToolResults, indeterminateOutcomeText, isAbortError, isBillingError, isContextOverflow, isLocalBackendUrl, isUsageLimitError, repairToolPairingAdjacent, setStreamDiagnostic, unknownToolMessage };
615
+ export { Agent, type AgentDoneEvent, type AgentErrorEvent, type AgentEvent, type AgentFollowUpMessageEvent, type AgentOptions, type AgentResult, type AgentRetryEvent, type AgentServerToolCallEvent, type AgentServerToolResultEvent, type AgentSteeringMessageEvent, AgentStream, type AgentStreamRuleTriggeredEvent, type AgentTextDeltaEvent, type AgentThinkingDeltaEvent, type AgentTool, type AgentToolCallDeltaEvent, type AgentToolCallEndEvent, type AgentToolCallStartEvent, type AgentToolCallUpdateEvent, type AgentTurnEndEvent, type AgentTurnTiming, DEFAULT_STREAM_RULE_MAX_RETRIES, DEFAULT_STREAM_RULE_WINDOW_CHARS, JsonEscapeDecoder, PREEMPT_GRACE_MS, STEER_INTERRUPTED_TEXT, type StreamDiagnosticFn, type StreamRule, type StreamRuleMatch, StreamRuleMonitor, type StreamRuleScope, type StreamRuleSource, type StreamRulesConfig, type StructuredToolResult, type ToolContext, type ToolExecuteResult, type ToolExecutionMode, type TransformContextOptions, agentLoop, argumentHints, buildStreamRuleReminder, cancelledBeforeStartText, capToolResults, indeterminateOutcomeText, isAbortError, isBillingError, isContextOverflow, isInterruptibleTool, isLocalBackendUrl, isUsageLimitError, markSteerInterrupted, repairToolPairingAdjacent, setStreamDiagnostic, unknownToolMessage };
package/dist/index.js CHANGED
@@ -2535,6 +2535,8 @@ export {
2535
2535
  DEFAULT_STREAM_RULE_MAX_RETRIES,
2536
2536
  DEFAULT_STREAM_RULE_WINDOW_CHARS,
2537
2537
  JsonEscapeDecoder,
2538
+ PREEMPT_GRACE_MS,
2539
+ STEER_INTERRUPTED_TEXT,
2538
2540
  StreamRuleMonitor,
2539
2541
  agentLoop,
2540
2542
  argumentHints,
@@ -2545,8 +2547,10 @@ export {
2545
2547
  isAbortError,
2546
2548
  isBillingError,
2547
2549
  isContextOverflow,
2550
+ isInterruptibleTool,
2548
2551
  isLocalBackendUrl,
2549
2552
  isUsageLimitError,
2553
+ markSteerInterrupted,
2550
2554
  repairToolPairingAdjacent,
2551
2555
  setStreamDiagnostic,
2552
2556
  unknownToolMessage