@kenkaiiii/gg-ai 5.29.0 → 5.30.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/dist/index.cjs +13 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -77,19 +77,31 @@ interface RawContent {
|
|
|
77
77
|
data: Record<string, unknown>;
|
|
78
78
|
}
|
|
79
79
|
type ContentPart = TextContent | ThinkingContent | ImageContent | VideoContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
80
|
-
|
|
80
|
+
type MessageProvenanceSource = "human" | "agent" | "runtime";
|
|
81
|
+
type MessageProvenanceKind = "prompt" | "steering" | "notification" | "completion_gate" | "review_follow_up" | "continuation" | "model_switch" | "automation" | "compaction_summary" | "compaction_ack";
|
|
82
|
+
type MessageProvenanceVisibility = "transcript" | "hidden" | "summary";
|
|
83
|
+
/** Internal message metadata. `stream()` removes it before provider dispatch. */
|
|
84
|
+
interface MessageProvenance {
|
|
85
|
+
source: MessageProvenanceSource;
|
|
86
|
+
kind: MessageProvenanceKind;
|
|
87
|
+
visibility: MessageProvenanceVisibility;
|
|
88
|
+
}
|
|
89
|
+
interface MessageMetadata {
|
|
90
|
+
provenance?: MessageProvenance;
|
|
91
|
+
}
|
|
92
|
+
interface SystemMessage extends MessageMetadata {
|
|
81
93
|
role: "system";
|
|
82
94
|
content: string;
|
|
83
95
|
}
|
|
84
|
-
interface UserMessage {
|
|
96
|
+
interface UserMessage extends MessageMetadata {
|
|
85
97
|
role: "user";
|
|
86
98
|
content: string | (TextContent | ImageContent | VideoContent)[];
|
|
87
99
|
}
|
|
88
|
-
interface AssistantMessage {
|
|
100
|
+
interface AssistantMessage extends MessageMetadata {
|
|
89
101
|
role: "assistant";
|
|
90
102
|
content: string | ContentPart[];
|
|
91
103
|
}
|
|
92
|
-
interface ToolResultMessage {
|
|
104
|
+
interface ToolResultMessage extends MessageMetadata {
|
|
93
105
|
role: "tool";
|
|
94
106
|
content: ToolResult[];
|
|
95
107
|
}
|
|
@@ -612,4 +624,4 @@ interface PalsuProviderConfig {
|
|
|
612
624
|
*/
|
|
613
625
|
declare function registerPalsuProvider(config?: PalsuProviderConfig): PalsuProviderHandle;
|
|
614
626
|
|
|
615
|
-
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, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, 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, clampProviderContextImages, classifyProviderError, environmentSecrets, formatError, formatErrorForDisplay, isHardBillingMessage, isUsageLimitError, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
|
627
|
+
export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, GGAIError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, 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, clampProviderContextImages, classifyProviderError, environmentSecrets, formatError, formatErrorForDisplay, isHardBillingMessage, isUsageLimitError, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
package/dist/index.d.ts
CHANGED
|
@@ -77,19 +77,31 @@ interface RawContent {
|
|
|
77
77
|
data: Record<string, unknown>;
|
|
78
78
|
}
|
|
79
79
|
type ContentPart = TextContent | ThinkingContent | ImageContent | VideoContent | ToolCall | ServerToolCall | ServerToolResult | RawContent;
|
|
80
|
-
|
|
80
|
+
type MessageProvenanceSource = "human" | "agent" | "runtime";
|
|
81
|
+
type MessageProvenanceKind = "prompt" | "steering" | "notification" | "completion_gate" | "review_follow_up" | "continuation" | "model_switch" | "automation" | "compaction_summary" | "compaction_ack";
|
|
82
|
+
type MessageProvenanceVisibility = "transcript" | "hidden" | "summary";
|
|
83
|
+
/** Internal message metadata. `stream()` removes it before provider dispatch. */
|
|
84
|
+
interface MessageProvenance {
|
|
85
|
+
source: MessageProvenanceSource;
|
|
86
|
+
kind: MessageProvenanceKind;
|
|
87
|
+
visibility: MessageProvenanceVisibility;
|
|
88
|
+
}
|
|
89
|
+
interface MessageMetadata {
|
|
90
|
+
provenance?: MessageProvenance;
|
|
91
|
+
}
|
|
92
|
+
interface SystemMessage extends MessageMetadata {
|
|
81
93
|
role: "system";
|
|
82
94
|
content: string;
|
|
83
95
|
}
|
|
84
|
-
interface UserMessage {
|
|
96
|
+
interface UserMessage extends MessageMetadata {
|
|
85
97
|
role: "user";
|
|
86
98
|
content: string | (TextContent | ImageContent | VideoContent)[];
|
|
87
99
|
}
|
|
88
|
-
interface AssistantMessage {
|
|
100
|
+
interface AssistantMessage extends MessageMetadata {
|
|
89
101
|
role: "assistant";
|
|
90
102
|
content: string | ContentPart[];
|
|
91
103
|
}
|
|
92
|
-
interface ToolResultMessage {
|
|
104
|
+
interface ToolResultMessage extends MessageMetadata {
|
|
93
105
|
role: "tool";
|
|
94
106
|
content: ToolResult[];
|
|
95
107
|
}
|
|
@@ -612,4 +624,4 @@ interface PalsuProviderConfig {
|
|
|
612
624
|
*/
|
|
613
625
|
declare function registerPalsuProvider(config?: PalsuProviderConfig): PalsuProviderHandle;
|
|
614
626
|
|
|
615
|
-
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, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, 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, clampProviderContextImages, classifyProviderError, environmentSecrets, formatError, formatErrorForDisplay, isHardBillingMessage, isUsageLimitError, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
|
627
|
+
export { type AssistantMessage, type CacheRetention, type ContentPart, type DoneEvent, type ErrorEvent, type ErrorSource, EventStream, type FormattedError, GGAIError, type ImageContent, type Message, type MessageProvenance, type MessageProvenanceKind, type MessageProvenanceSource, type MessageProvenanceVisibility, type PalsuModelConfig, type PalsuModelHandle, type PalsuProviderConfig, type PalsuProviderHandle, type PalsuProviderState, type PalsuResponse, type PalsuResponseFactory, type Provider, type ProviderDiagnosticFn, type ProviderEntry, ProviderError, type ProviderStreamFn, REDACTED as REDACTION_MARKER, type RawContent, type RedactionOptions, 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, clampProviderContextImages, classifyProviderError, environmentSecrets, formatError, formatErrorForDisplay, isHardBillingMessage, isUsageLimitError, localWireModelId, palsuAssistantMessage, palsuText, palsuThinking, palsuToolCall, prewarmAnthropicCache, providerRegistry, redactText, redactValue, registerPalsuProvider, setProviderDiagnostic, stream, toAnthropicMessages, toOpenAIMessages };
|
package/dist/index.js
CHANGED
|
@@ -3550,13 +3550,25 @@ function stream(options) {
|
|
|
3550
3550
|
if (options.supportsVideo !== true && messagesContainVideo(options.messages)) {
|
|
3551
3551
|
throw new VideoUnsupportedError();
|
|
3552
3552
|
}
|
|
3553
|
+
const wireMessages = stripMessageProvenance(options.messages);
|
|
3553
3554
|
const messages = clampProviderContextImages(
|
|
3554
|
-
|
|
3555
|
+
wireMessages,
|
|
3555
3556
|
options.provider,
|
|
3556
3557
|
options.supportsImages
|
|
3557
3558
|
);
|
|
3558
3559
|
return entry.stream(messages === options.messages ? options : { ...options, messages });
|
|
3559
3560
|
}
|
|
3561
|
+
function stripMessageProvenance(messages) {
|
|
3562
|
+
let stripped;
|
|
3563
|
+
for (let index = 0; index < messages.length; index++) {
|
|
3564
|
+
const message = messages[index];
|
|
3565
|
+
if (!message.provenance) continue;
|
|
3566
|
+
stripped ??= messages.slice();
|
|
3567
|
+
const { provenance: _provenance, ...wireMessage } = message;
|
|
3568
|
+
stripped[index] = wireMessage;
|
|
3569
|
+
}
|
|
3570
|
+
return stripped ?? messages;
|
|
3571
|
+
}
|
|
3560
3572
|
function messagesContainVideo(messages) {
|
|
3561
3573
|
for (const msg of messages) {
|
|
3562
3574
|
if (typeof msg.content === "string" || !Array.isArray(msg.content)) continue;
|