@kenkaiiii/gg-ai 5.94.0 → 5.95.0
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/README.md +16 -16
- package/dist/index.cjs +211 -314
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -21
- package/dist/index.d.ts +17 -21
- package/dist/index.js +210 -313
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -253,26 +253,18 @@ interface StreamOptions {
|
|
|
253
253
|
/** OpenAI service tier for latency-sensitive requests. Only sent to first-party OpenAI API calls. */
|
|
254
254
|
serviceTier?: "auto" | "default" | "flex" | "priority";
|
|
255
255
|
/** Provider speed tier. "fast" sends Anthropic `speed: "fast"` (first-party API
|
|
256
|
-
* only) or OpenAI
|
|
256
|
+
* only) or OpenAI `service_tier: "priority"`. Set automatically by
|
|
257
257
|
* `stream()` for fast-mode model ids (see `resolveFastModeModel`). */
|
|
258
258
|
speed?: "standard" | "fast";
|
|
259
|
-
/**
|
|
260
|
-
* `parallel_tool_calls: false`, all-turns reasoning context). Unset follows
|
|
261
|
-
* the model family (on for gpt-5.6/gpt-6 models). Lite allows only one tool
|
|
262
|
-
* call per response, so turning it off lets the model batch calls. */
|
|
263
|
-
responsesLite?: boolean;
|
|
264
|
-
/** OpenAI only (Codex and API-key routes): send tools with strict
|
|
259
|
+
/** OpenAI only (ChatGPT plan and API-key routes): send tools with strict
|
|
265
260
|
* (grammar-constrained) schemas. Default true. Strict calls carry every
|
|
266
261
|
* optional field as null, which costs output tokens and latency per call. */
|
|
267
262
|
strictTools?: boolean;
|
|
268
|
-
/**
|
|
263
|
+
/** ChatGPT plan sign-in: the account subject. Set, it routes OpenAI to the plan. */
|
|
269
264
|
accountId?: string;
|
|
270
|
-
/** Stable conversation identity
|
|
271
|
-
*
|
|
272
|
-
* retain independent session/thread identities. */
|
|
265
|
+
/** Stable conversation identity, distinct from promptCacheKey: sessions with
|
|
266
|
+
* matching prefixes may share a cache key but keep independent identities. */
|
|
273
267
|
transportSessionId?: string;
|
|
274
|
-
/** Google Cloud/Code Assist project ID used by Gemini OAuth transport. */
|
|
275
|
-
projectId?: string;
|
|
276
268
|
/** Enable provider-native web search. Each provider uses its own format:
|
|
277
269
|
* - Anthropic: server tool `web_search_20250305`
|
|
278
270
|
* - Moonshot: `builtin_function` `$web_search`
|
|
@@ -315,10 +307,8 @@ interface StreamOptions {
|
|
|
315
307
|
* budget_tokens < max_tokens), no request is sent and the response has
|
|
316
308
|
* zero usage with stopReason "end_turn". */
|
|
317
309
|
prewarm?: boolean;
|
|
318
|
-
/** Extra HTTP headers attached to every model request.
|
|
319
|
-
*
|
|
320
|
-
* `User-Agent: kimi-code-cli/...` and `X-Msh-*` device headers). Merged
|
|
321
|
-
* into the underlying SDK's default headers. */
|
|
310
|
+
/** Extra HTTP headers attached to every model request. Merged into the
|
|
311
|
+
* underlying SDK's default headers. */
|
|
322
312
|
defaultHeaders?: Record<string, string>;
|
|
323
313
|
/** Provider-specific request-body fields, merged into the JSON body of every
|
|
324
314
|
* model request (e.g. OpenRouter's routing object:
|
|
@@ -979,8 +969,8 @@ declare const TOOL_CALL_NAME_RULES: Record<ToolCallNameRule["id"], ToolCallNameR
|
|
|
979
969
|
declare function isValidToolCallName(name: unknown, rule: ToolCallNameRule): boolean;
|
|
980
970
|
/**
|
|
981
971
|
* Pick the tool-name rule for the transport a request will actually use. Mirrors
|
|
982
|
-
* the routing in `stream.ts`: `openai`
|
|
983
|
-
*
|
|
972
|
+
* the routing in `stream.ts`: `openai` itself (the ChatGPT plan or an API key)
|
|
973
|
+
* is the Responses API, MiniMax rides the Anthropic transport but is a third
|
|
984
974
|
* party, and an `openai` pointed at a custom baseUrl is an unknown compatible
|
|
985
975
|
* server.
|
|
986
976
|
*/
|
|
@@ -1041,9 +1031,15 @@ declare function continuesTurn(message: Message): boolean;
|
|
|
1041
1031
|
/** A real turn boundary: a user message that isn't a runtime notice. */
|
|
1042
1032
|
declare function opensTurn(message: Message): boolean;
|
|
1043
1033
|
|
|
1044
|
-
|
|
1034
|
+
/**
|
|
1035
|
+
* GPT-6 family (and gpt-5.6): reasoning can't be turned off, and the models
|
|
1036
|
+
* default to low verbosity. Point releases keep the dotted version (gpt-6.1-sol).
|
|
1037
|
+
*/
|
|
1045
1038
|
declare function usesResponsesLite(model: string): boolean;
|
|
1046
1039
|
|
|
1040
|
+
/** GG Coder's own client identity. Sent where a provider needs a User-Agent; never another vendor's. */
|
|
1041
|
+
declare const GG_CODER_USER_AGENT = "ggcoder (+https://github.com/KenKaiii/gg-coder)";
|
|
1042
|
+
|
|
1047
1043
|
/**
|
|
1048
1044
|
* Fire a minimal `max_tokens: 1` request that populates the Anthropic prompt
|
|
1049
1045
|
* cache with the system prompt + tools prefix, so the first real user turn is
|
|
@@ -1151,4 +1147,4 @@ declare function palsuEmbedding(text: string, dimensions?: number): number[];
|
|
|
1151
1147
|
/** Deterministic fake relevance: the share of distinct query words found in the document (0–1). */
|
|
1152
1148
|
declare function palsuRerankScore(query: string, document: string): number;
|
|
1153
1149
|
|
|
1154
|
-
export { type AssistantMessage,
|
|
1150
|
+
export { type AssistantMessage, 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, GG_CODER_USER_AGENT, type ImageContent, LOCAL_NO_API_KEY, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type OpenRouterProviderPreferences, PRECONNECT_INTERVAL_MS, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreconnectOptions, 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, localBearerKey, localWireModelId, opensTurn, palsuAssistantMessage, palsuEmbedding, palsuRerankScore, palsuText, palsuThinking, palsuToolCall, parseFastModeRejection, preconnectOrigin, preconnectProvider, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, rerank, resolveFastModeModel, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
|
package/dist/index.d.ts
CHANGED
|
@@ -253,26 +253,18 @@ interface StreamOptions {
|
|
|
253
253
|
/** OpenAI service tier for latency-sensitive requests. Only sent to first-party OpenAI API calls. */
|
|
254
254
|
serviceTier?: "auto" | "default" | "flex" | "priority";
|
|
255
255
|
/** Provider speed tier. "fast" sends Anthropic `speed: "fast"` (first-party API
|
|
256
|
-
* only) or OpenAI
|
|
256
|
+
* only) or OpenAI `service_tier: "priority"`. Set automatically by
|
|
257
257
|
* `stream()` for fast-mode model ids (see `resolveFastModeModel`). */
|
|
258
258
|
speed?: "standard" | "fast";
|
|
259
|
-
/**
|
|
260
|
-
* `parallel_tool_calls: false`, all-turns reasoning context). Unset follows
|
|
261
|
-
* the model family (on for gpt-5.6/gpt-6 models). Lite allows only one tool
|
|
262
|
-
* call per response, so turning it off lets the model batch calls. */
|
|
263
|
-
responsesLite?: boolean;
|
|
264
|
-
/** OpenAI only (Codex and API-key routes): send tools with strict
|
|
259
|
+
/** OpenAI only (ChatGPT plan and API-key routes): send tools with strict
|
|
265
260
|
* (grammar-constrained) schemas. Default true. Strict calls carry every
|
|
266
261
|
* optional field as null, which costs output tokens and latency per call. */
|
|
267
262
|
strictTools?: boolean;
|
|
268
|
-
/**
|
|
263
|
+
/** ChatGPT plan sign-in: the account subject. Set, it routes OpenAI to the plan. */
|
|
269
264
|
accountId?: string;
|
|
270
|
-
/** Stable conversation identity
|
|
271
|
-
*
|
|
272
|
-
* retain independent session/thread identities. */
|
|
265
|
+
/** Stable conversation identity, distinct from promptCacheKey: sessions with
|
|
266
|
+
* matching prefixes may share a cache key but keep independent identities. */
|
|
273
267
|
transportSessionId?: string;
|
|
274
|
-
/** Google Cloud/Code Assist project ID used by Gemini OAuth transport. */
|
|
275
|
-
projectId?: string;
|
|
276
268
|
/** Enable provider-native web search. Each provider uses its own format:
|
|
277
269
|
* - Anthropic: server tool `web_search_20250305`
|
|
278
270
|
* - Moonshot: `builtin_function` `$web_search`
|
|
@@ -315,10 +307,8 @@ interface StreamOptions {
|
|
|
315
307
|
* budget_tokens < max_tokens), no request is sent and the response has
|
|
316
308
|
* zero usage with stopReason "end_turn". */
|
|
317
309
|
prewarm?: boolean;
|
|
318
|
-
/** Extra HTTP headers attached to every model request.
|
|
319
|
-
*
|
|
320
|
-
* `User-Agent: kimi-code-cli/...` and `X-Msh-*` device headers). Merged
|
|
321
|
-
* into the underlying SDK's default headers. */
|
|
310
|
+
/** Extra HTTP headers attached to every model request. Merged into the
|
|
311
|
+
* underlying SDK's default headers. */
|
|
322
312
|
defaultHeaders?: Record<string, string>;
|
|
323
313
|
/** Provider-specific request-body fields, merged into the JSON body of every
|
|
324
314
|
* model request (e.g. OpenRouter's routing object:
|
|
@@ -979,8 +969,8 @@ declare const TOOL_CALL_NAME_RULES: Record<ToolCallNameRule["id"], ToolCallNameR
|
|
|
979
969
|
declare function isValidToolCallName(name: unknown, rule: ToolCallNameRule): boolean;
|
|
980
970
|
/**
|
|
981
971
|
* Pick the tool-name rule for the transport a request will actually use. Mirrors
|
|
982
|
-
* the routing in `stream.ts`: `openai`
|
|
983
|
-
*
|
|
972
|
+
* the routing in `stream.ts`: `openai` itself (the ChatGPT plan or an API key)
|
|
973
|
+
* is the Responses API, MiniMax rides the Anthropic transport but is a third
|
|
984
974
|
* party, and an `openai` pointed at a custom baseUrl is an unknown compatible
|
|
985
975
|
* server.
|
|
986
976
|
*/
|
|
@@ -1041,9 +1031,15 @@ declare function continuesTurn(message: Message): boolean;
|
|
|
1041
1031
|
/** A real turn boundary: a user message that isn't a runtime notice. */
|
|
1042
1032
|
declare function opensTurn(message: Message): boolean;
|
|
1043
1033
|
|
|
1044
|
-
|
|
1034
|
+
/**
|
|
1035
|
+
* GPT-6 family (and gpt-5.6): reasoning can't be turned off, and the models
|
|
1036
|
+
* default to low verbosity. Point releases keep the dotted version (gpt-6.1-sol).
|
|
1037
|
+
*/
|
|
1045
1038
|
declare function usesResponsesLite(model: string): boolean;
|
|
1046
1039
|
|
|
1040
|
+
/** GG Coder's own client identity. Sent where a provider needs a User-Agent; never another vendor's. */
|
|
1041
|
+
declare const GG_CODER_USER_AGENT = "ggcoder (+https://github.com/KenKaiii/gg-coder)";
|
|
1042
|
+
|
|
1047
1043
|
/**
|
|
1048
1044
|
* Fire a minimal `max_tokens: 1` request that populates the Anthropic prompt
|
|
1049
1045
|
* cache with the system prompt + tools prefix, so the first real user turn is
|
|
@@ -1151,4 +1147,4 @@ declare function palsuEmbedding(text: string, dimensions?: number): number[];
|
|
|
1151
1147
|
/** Deterministic fake relevance: the share of distinct query words found in the document (0–1). */
|
|
1152
1148
|
declare function palsuRerankScore(query: string, document: string): number;
|
|
1153
1149
|
|
|
1154
|
-
export { type AssistantMessage,
|
|
1150
|
+
export { type AssistantMessage, 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, GG_CODER_USER_AGENT, type ImageContent, LOCAL_NO_API_KEY, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type OpenRouterProviderPreferences, PRECONNECT_INTERVAL_MS, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type PreconnectOptions, 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, localBearerKey, localWireModelId, opensTurn, palsuAssistantMessage, palsuEmbedding, palsuRerankScore, palsuText, palsuThinking, palsuToolCall, parseFastModeRejection, preconnectOrigin, preconnectProvider, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, rerank, resolveFastModeModel, resolveToolSchema, sanitizeMessagesForWire, setProviderDiagnostic, sliceHead, sliceTail, stream, toAnthropicMessages, toOpenAIMessages, toWellFormedText, toolCallNameRuleFor, usesResponsesLite };
|