@kenkaiiii/gg-ai 5.83.2 → 5.83.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 +497 -262
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +496 -262
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -77,6 +77,12 @@ interface ServerToolResult {
|
|
|
77
77
|
interface RawContent {
|
|
78
78
|
type: "raw";
|
|
79
79
|
data: Record<string, unknown>;
|
|
80
|
+
/**
|
|
81
|
+
* Which transport and model produced an opaque block whose replay is only
|
|
82
|
+
* valid there (e.g. `"xai:grok-4.7"` for Grok's encrypted reasoning). Never
|
|
83
|
+
* sent on the wire. Absent on blocks from before this field existed.
|
|
84
|
+
*/
|
|
85
|
+
origin?: string;
|
|
80
86
|
}
|
|
81
87
|
type ContentPart = TextContent | ThinkingContent | ImageContent | VideoContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
82
88
|
type MessageProvenanceSource = "human" | "agent" | "runtime";
|
|
@@ -165,6 +171,12 @@ interface ServerToolResultEvent {
|
|
|
165
171
|
}
|
|
166
172
|
interface KeepaliveEvent {
|
|
167
173
|
type: "keepalive";
|
|
174
|
+
/**
|
|
175
|
+
* The model is reasoning, but the reasoning is hidden from the UI (thinking
|
|
176
|
+
* display off on a model that always reasons). Watchdogs treat it like a
|
|
177
|
+
* thinking delta; nothing is rendered.
|
|
178
|
+
*/
|
|
179
|
+
reasoning?: true;
|
|
168
180
|
}
|
|
169
181
|
type StreamEvent = TextDeltaEvent | ThinkingDeltaEvent | ToolCallDeltaEvent | ToolCallDoneEvent | ServerToolCallEvent | ServerToolResultEvent | DoneEvent | ErrorEvent | KeepaliveEvent;
|
|
170
182
|
type StopReason = "end_turn" | "tool_use" | "max_tokens" | "pause_turn" | "stop_sequence" | "refusal" | "error";
|
|
@@ -714,6 +726,22 @@ declare class GGAIError extends Error {
|
|
|
714
726
|
cause?: unknown;
|
|
715
727
|
});
|
|
716
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* Every automatic retry connected to the provider but the reply never finished:
|
|
731
|
+
* the provider went silent mid-response (or the full non-streamed reply never
|
|
732
|
+
* arrived in time). Distinct from "couldn't reach the provider" — the network
|
|
733
|
+
* worked, the response was too slow or too large to complete.
|
|
734
|
+
* `inToolCall` is set when the replies kept dying while the model was still
|
|
735
|
+
* writing a tool call's arguments, which is almost always one oversized write.
|
|
736
|
+
*/
|
|
737
|
+
declare class ResponseStalledError extends GGAIError {
|
|
738
|
+
readonly inToolCall: boolean;
|
|
739
|
+
constructor(message: string, options: {
|
|
740
|
+
inToolCall: boolean;
|
|
741
|
+
hint?: string;
|
|
742
|
+
cause?: unknown;
|
|
743
|
+
});
|
|
744
|
+
}
|
|
717
745
|
declare class ProviderError extends GGAIError {
|
|
718
746
|
readonly provider: string;
|
|
719
747
|
readonly statusCode?: number;
|
|
@@ -1072,4 +1100,4 @@ declare function palsuEmbedding(text: string, dimensions?: number): number[];
|
|
|
1072
1100
|
/** Deterministic fake relevance: the share of distinct query words found in the document (0–1). */
|
|
1073
1101
|
declare function palsuRerankScore(query: string, document: string): number;
|
|
1074
1102
|
|
|
1075
|
-
export { type AssistantMessage, CODEX_CLIENT_VERSION, type CacheRetention, type ChatErrorReason, type ContentPart, type DoneEvent, type EmbedInputType, type EmbedOptions, type EmbedResult, type EmbedUsage, type ErrorEvent, type ErrorSource, EventStream, FAST_MODE_SUFFIX, type FastModeRejection, type FastModeResolution, type FormattedChatError, type FormattedError, GGAIError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type OpenRouterProviderPreferences, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreparedContext, type Provider, type ProviderCapability, type ProviderDiagnosticFn, type ProviderEmbedFn, type ProviderEmbedRequest, type ProviderEmbedResponse, type ProviderEntry, ProviderError, type ProviderOptions, type ProviderRerankFn, type ProviderRerankRequest, type ProviderRerankResponse, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type RerankOptions, type RerankResponse, type RerankResult, type RerankUsage, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, TOOL_CALL_NAME_RULES, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolCallNameRule, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, continuesTurn, describeFastModeRejection, dropInvalidToolCalls, embed, environmentSecrets, formatChatError, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, isValidToolCallName, localWireModelId, opensTurn, palsuAssistantMessage, palsuEmbedding, palsuRerankScore, palsuText, palsuThinking, palsuToolCall, parseFastModeRejection, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, rerank, resolveFastModeModel, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
|
|
1103
|
+
export { type AssistantMessage, CODEX_CLIENT_VERSION, type CacheRetention, type ChatErrorReason, type ContentPart, type DoneEvent, type EmbedInputType, type EmbedOptions, type EmbedResult, type EmbedUsage, type ErrorEvent, type ErrorSource, EventStream, FAST_MODE_SUFFIX, type FastModeRejection, type FastModeResolution, type FormattedChatError, type FormattedError, GGAIError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type OpenRouterProviderPreferences, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreparedContext, type Provider, type ProviderCapability, type ProviderDiagnosticFn, type ProviderEmbedFn, type ProviderEmbedRequest, type ProviderEmbedResponse, type ProviderEntry, ProviderError, type ProviderOptions, type ProviderRerankFn, type ProviderRerankRequest, type ProviderRerankResponse, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type RerankOptions, type RerankResponse, type RerankResult, type RerankUsage, ResponseStalledError, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, TOOL_CALL_NAME_RULES, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolCallNameRule, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, continuesTurn, describeFastModeRejection, dropInvalidToolCalls, embed, environmentSecrets, formatChatError, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, isValidToolCallName, localWireModelId, opensTurn, palsuAssistantMessage, palsuEmbedding, palsuRerankScore, palsuText, palsuThinking, palsuToolCall, parseFastModeRejection, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, rerank, resolveFastModeModel, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
|
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,12 @@ interface ServerToolResult {
|
|
|
77
77
|
interface RawContent {
|
|
78
78
|
type: "raw";
|
|
79
79
|
data: Record<string, unknown>;
|
|
80
|
+
/**
|
|
81
|
+
* Which transport and model produced an opaque block whose replay is only
|
|
82
|
+
* valid there (e.g. `"xai:grok-4.7"` for Grok's encrypted reasoning). Never
|
|
83
|
+
* sent on the wire. Absent on blocks from before this field existed.
|
|
84
|
+
*/
|
|
85
|
+
origin?: string;
|
|
80
86
|
}
|
|
81
87
|
type ContentPart = TextContent | ThinkingContent | ImageContent | VideoContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
82
88
|
type MessageProvenanceSource = "human" | "agent" | "runtime";
|
|
@@ -165,6 +171,12 @@ interface ServerToolResultEvent {
|
|
|
165
171
|
}
|
|
166
172
|
interface KeepaliveEvent {
|
|
167
173
|
type: "keepalive";
|
|
174
|
+
/**
|
|
175
|
+
* The model is reasoning, but the reasoning is hidden from the UI (thinking
|
|
176
|
+
* display off on a model that always reasons). Watchdogs treat it like a
|
|
177
|
+
* thinking delta; nothing is rendered.
|
|
178
|
+
*/
|
|
179
|
+
reasoning?: true;
|
|
168
180
|
}
|
|
169
181
|
type StreamEvent = TextDeltaEvent | ThinkingDeltaEvent | ToolCallDeltaEvent | ToolCallDoneEvent | ServerToolCallEvent | ServerToolResultEvent | DoneEvent | ErrorEvent | KeepaliveEvent;
|
|
170
182
|
type StopReason = "end_turn" | "tool_use" | "max_tokens" | "pause_turn" | "stop_sequence" | "refusal" | "error";
|
|
@@ -714,6 +726,22 @@ declare class GGAIError extends Error {
|
|
|
714
726
|
cause?: unknown;
|
|
715
727
|
});
|
|
716
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* Every automatic retry connected to the provider but the reply never finished:
|
|
731
|
+
* the provider went silent mid-response (or the full non-streamed reply never
|
|
732
|
+
* arrived in time). Distinct from "couldn't reach the provider" — the network
|
|
733
|
+
* worked, the response was too slow or too large to complete.
|
|
734
|
+
* `inToolCall` is set when the replies kept dying while the model was still
|
|
735
|
+
* writing a tool call's arguments, which is almost always one oversized write.
|
|
736
|
+
*/
|
|
737
|
+
declare class ResponseStalledError extends GGAIError {
|
|
738
|
+
readonly inToolCall: boolean;
|
|
739
|
+
constructor(message: string, options: {
|
|
740
|
+
inToolCall: boolean;
|
|
741
|
+
hint?: string;
|
|
742
|
+
cause?: unknown;
|
|
743
|
+
});
|
|
744
|
+
}
|
|
717
745
|
declare class ProviderError extends GGAIError {
|
|
718
746
|
readonly provider: string;
|
|
719
747
|
readonly statusCode?: number;
|
|
@@ -1072,4 +1100,4 @@ declare function palsuEmbedding(text: string, dimensions?: number): number[];
|
|
|
1072
1100
|
/** Deterministic fake relevance: the share of distinct query words found in the document (0–1). */
|
|
1073
1101
|
declare function palsuRerankScore(query: string, document: string): number;
|
|
1074
1102
|
|
|
1075
|
-
export { type AssistantMessage, CODEX_CLIENT_VERSION, type CacheRetention, type ChatErrorReason, type ContentPart, type DoneEvent, type EmbedInputType, type EmbedOptions, type EmbedResult, type EmbedUsage, type ErrorEvent, type ErrorSource, EventStream, FAST_MODE_SUFFIX, type FastModeRejection, type FastModeResolution, type FormattedChatError, type FormattedError, GGAIError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type OpenRouterProviderPreferences, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreparedContext, type Provider, type ProviderCapability, type ProviderDiagnosticFn, type ProviderEmbedFn, type ProviderEmbedRequest, type ProviderEmbedResponse, type ProviderEntry, ProviderError, type ProviderOptions, type ProviderRerankFn, type ProviderRerankRequest, type ProviderRerankResponse, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type RerankOptions, type RerankResponse, type RerankResult, type RerankUsage, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, TOOL_CALL_NAME_RULES, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolCallNameRule, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, continuesTurn, describeFastModeRejection, dropInvalidToolCalls, embed, environmentSecrets, formatChatError, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, isValidToolCallName, localWireModelId, opensTurn, palsuAssistantMessage, palsuEmbedding, palsuRerankScore, palsuText, palsuThinking, palsuToolCall, parseFastModeRejection, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, rerank, resolveFastModeModel, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
|
|
1103
|
+
export { type AssistantMessage, CODEX_CLIENT_VERSION, type CacheRetention, type ChatErrorReason, type ContentPart, type DoneEvent, type EmbedInputType, type EmbedOptions, type EmbedResult, type EmbedUsage, type ErrorEvent, type ErrorSource, EventStream, FAST_MODE_SUFFIX, type FastModeRejection, type FastModeResolution, type FormattedChatError, type FormattedError, GGAIError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type OpenRouterProviderPreferences, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreparedContext, type Provider, type ProviderCapability, type ProviderDiagnosticFn, type ProviderEmbedFn, type ProviderEmbedRequest, type ProviderEmbedResponse, type ProviderEntry, ProviderError, type ProviderOptions, type ProviderRerankFn, type ProviderRerankRequest, type ProviderRerankResponse, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, type RerankOptions, type RerankResponse, type RerankResult, type RerankUsage, ResponseStalledError, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, TOOL_CALL_NAME_RULES, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolCallNameRule, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, clampProviderContextImages, classifyProviderError, continuesTurn, describeFastModeRejection, dropInvalidToolCalls, embed, environmentSecrets, formatChatError, formatError, formatErrorForDisplay, hasLoneSurrogate, isHardBillingMessage, isUsageLimitError, isValidToolCallName, localWireModelId, opensTurn, palsuAssistantMessage, palsuEmbedding, palsuRerankScore, palsuText, palsuThinking, palsuToolCall, parseFastModeRejection, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, rerank, resolveFastModeModel, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
|