@kenkaiiii/gg-ai 4.3.237 → 4.3.239
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 +274 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +273 -172
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,11 @@ interface ImageContent {
|
|
|
19
19
|
mediaType: string;
|
|
20
20
|
data: string;
|
|
21
21
|
}
|
|
22
|
+
interface VideoContent {
|
|
23
|
+
type: "video";
|
|
24
|
+
mediaType: string;
|
|
25
|
+
data: string;
|
|
26
|
+
}
|
|
22
27
|
interface ToolCall {
|
|
23
28
|
type: "tool_call";
|
|
24
29
|
id: string;
|
|
@@ -49,14 +54,14 @@ interface RawContent {
|
|
|
49
54
|
type: "raw";
|
|
50
55
|
data: Record<string, unknown>;
|
|
51
56
|
}
|
|
52
|
-
type ContentPart = TextContent | ThinkingContent | ImageContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
57
|
+
type ContentPart = TextContent | ThinkingContent | ImageContent | VideoContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
53
58
|
interface SystemMessage {
|
|
54
59
|
role: "system";
|
|
55
60
|
content: string;
|
|
56
61
|
}
|
|
57
62
|
interface UserMessage {
|
|
58
63
|
role: "user";
|
|
59
|
-
content: string | (TextContent | ImageContent)[];
|
|
64
|
+
content: string | (TextContent | ImageContent | VideoContent)[];
|
|
60
65
|
}
|
|
61
66
|
interface AssistantMessage {
|
|
62
67
|
role: "assistant";
|
|
@@ -187,6 +192,10 @@ interface StreamOptions {
|
|
|
187
192
|
* in user messages and tool_result messages is downgraded to a text placeholder
|
|
188
193
|
* before being sent to the provider. Default: true. */
|
|
189
194
|
supportsImages?: boolean;
|
|
195
|
+
/** Whether the target model supports video input. When false, video content
|
|
196
|
+
* in user messages is downgraded to a text placeholder before being sent to
|
|
197
|
+
* the provider. Default: false. */
|
|
198
|
+
supportsVideo?: boolean;
|
|
190
199
|
/** Use streaming transport (default: true). When false, providers issue a
|
|
191
200
|
* single non-streaming request and synthesize events from the full response.
|
|
192
201
|
* The agent loop flips this to `false` as a fallback after repeated stream
|
|
@@ -377,6 +386,13 @@ declare class ProviderError extends GGAIError {
|
|
|
377
386
|
* "usage limit reached" message gg-ai stamps onto the ProviderError.
|
|
378
387
|
*/
|
|
379
388
|
declare function isUsageLimitError(err: unknown): boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Substrings that mark a hard, non-retriable billing/quota stop on ANY provider
|
|
391
|
+
* (credit exhaustion, balance too low, plan quota spent). Single source of truth
|
|
392
|
+
* shared across the OpenAI-compatible and Anthropic provider boundaries and the
|
|
393
|
+
* agent-loop retry classifier, so the lists can't drift. Matched case-insensitively.
|
|
394
|
+
*/
|
|
395
|
+
declare function isHardBillingMessage(message: string): boolean;
|
|
380
396
|
declare function formatError(err: unknown): FormattedError;
|
|
381
397
|
/**
|
|
382
398
|
* Render a FormattedError as a multi-line string for terminal display.
|
|
@@ -480,4 +496,4 @@ interface PalsuProviderConfig {
|
|
|
480
496
|
*/
|
|
481
497
|
declare function registerPalsuProvider(config?: PalsuProviderConfig): PalsuProviderHandle;
|
|
482
498
|
|
|
483
|
-
export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, GGAIError, type ImageContent, type Message, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, type RawContent, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, formatError, formatErrorForDisplay, isUsageLimitError, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, providerRegistry, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
|
499
|
+
export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, GGAIError, type ImageContent, type Message, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, type RawContent, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, formatError, formatErrorForDisplay, isHardBillingMessage, isUsageLimitError, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, providerRegistry, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ interface ImageContent {
|
|
|
19
19
|
mediaType: string;
|
|
20
20
|
data: string;
|
|
21
21
|
}
|
|
22
|
+
interface VideoContent {
|
|
23
|
+
type: "video";
|
|
24
|
+
mediaType: string;
|
|
25
|
+
data: string;
|
|
26
|
+
}
|
|
22
27
|
interface ToolCall {
|
|
23
28
|
type: "tool_call";
|
|
24
29
|
id: string;
|
|
@@ -49,14 +54,14 @@ interface RawContent {
|
|
|
49
54
|
type: "raw";
|
|
50
55
|
data: Record<string, unknown>;
|
|
51
56
|
}
|
|
52
|
-
type ContentPart = TextContent | ThinkingContent | ImageContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
57
|
+
type ContentPart = TextContent | ThinkingContent | ImageContent | VideoContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
53
58
|
interface SystemMessage {
|
|
54
59
|
role: "system";
|
|
55
60
|
content: string;
|
|
56
61
|
}
|
|
57
62
|
interface UserMessage {
|
|
58
63
|
role: "user";
|
|
59
|
-
content: string | (TextContent | ImageContent)[];
|
|
64
|
+
content: string | (TextContent | ImageContent | VideoContent)[];
|
|
60
65
|
}
|
|
61
66
|
interface AssistantMessage {
|
|
62
67
|
role: "assistant";
|
|
@@ -187,6 +192,10 @@ interface StreamOptions {
|
|
|
187
192
|
* in user messages and tool_result messages is downgraded to a text placeholder
|
|
188
193
|
* before being sent to the provider. Default: true. */
|
|
189
194
|
supportsImages?: boolean;
|
|
195
|
+
/** Whether the target model supports video input. When false, video content
|
|
196
|
+
* in user messages is downgraded to a text placeholder before being sent to
|
|
197
|
+
* the provider. Default: false. */
|
|
198
|
+
supportsVideo?: boolean;
|
|
190
199
|
/** Use streaming transport (default: true). When false, providers issue a
|
|
191
200
|
* single non-streaming request and synthesize events from the full response.
|
|
192
201
|
* The agent loop flips this to `false` as a fallback after repeated stream
|
|
@@ -377,6 +386,13 @@ declare class ProviderError extends GGAIError {
|
|
|
377
386
|
* "usage limit reached" message gg-ai stamps onto the ProviderError.
|
|
378
387
|
*/
|
|
379
388
|
declare function isUsageLimitError(err: unknown): boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Substrings that mark a hard, non-retriable billing/quota stop on ANY provider
|
|
391
|
+
* (credit exhaustion, balance too low, plan quota spent). Single source of truth
|
|
392
|
+
* shared across the OpenAI-compatible and Anthropic provider boundaries and the
|
|
393
|
+
* agent-loop retry classifier, so the lists can't drift. Matched case-insensitively.
|
|
394
|
+
*/
|
|
395
|
+
declare function isHardBillingMessage(message: string): boolean;
|
|
380
396
|
declare function formatError(err: unknown): FormattedError;
|
|
381
397
|
/**
|
|
382
398
|
* Render a FormattedError as a multi-line string for terminal display.
|
|
@@ -480,4 +496,4 @@ interface PalsuProviderConfig {
|
|
|
480
496
|
*/
|
|
481
497
|
declare function registerPalsuProvider(config?: PalsuProviderConfig): PalsuProviderHandle;
|
|
482
498
|
|
|
483
|
-
export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, GGAIError, type ImageContent, type Message, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, type RawContent, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, formatError, formatErrorForDisplay, isUsageLimitError, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, providerRegistry, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
|
499
|
+
export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, GGAIError, type ImageContent, type Message, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, type RawContent, type ServerToolCall, type ServerToolCallEvent, type ServerToolDefinition, type ServerToolResult, type ServerToolResultEvent, type StopReason, type StreamEvent, type StreamOptions, type StreamResponse, StreamResult, type SystemMessage, type TextContent, type TextDeltaEvent, type ThinkingContent, type ThinkingDeltaEvent, type ThinkingLevel, type Tool, type ToolCall, type ToolCallDeltaEvent, type ToolCallDoneEvent, type ToolChoice, type ToolResult, type ToolResultContent, type ToolResultMessage, type Usage, type UserMessage, type VideoContent, formatError, formatErrorForDisplay, isHardBillingMessage, isUsageLimitError, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, providerRegistry, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|