"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgentThoughtStreamingEvent$inboundSchema = exports.AgentThoughtStreamingEventData$inboundSchema = exports.AgentThoughtStreamingEventUsage$inboundSchema = exports.AgentThoughtStreamingEventCompletionTokensDetails$inboundSchema = exports.AgentThoughtStreamingEventPromptTokensDetails$inboundSchema = exports.Choice$inboundSchema = exports.Logprobs$inboundSchema = exports.Refusal$inboundSchema = exports.AgentThoughtStreamingEventTopLogprobs$inboundSchema = exports.Content$inboundSchema = exports.TopLogprobs$inboundSchema = exports.AgentThoughtStreamingEventMessage$inboundSchema = exports.Audio$inboundSchema = exports.AgentThoughtStreamingEventDataRole$inboundSchema = exports.ToolCalls$inboundSchema = exports.AgentThoughtStreamingEventFunction$inboundSchema = exports.AgentThoughtStreamingEventDataType$inboundSchema = exports.AgentThoughtStreamingEventFinishReason$inboundSchema = exports.MessageDifference$inboundSchema = exports.AgentThoughtStreamingEventParts$inboundSchema = exports.AgentThoughtStreamingEventRole$inboundSchema = exports.AgentThoughtStreamingEventDataRole = exports.AgentThoughtStreamingEventDataType = exports.AgentThoughtStreamingEventFinishReason = exports.AgentThoughtStreamingEventRole = void 0;
exports.agentThoughtStreamingEventPartsFromJSON = agentThoughtStreamingEventPartsFromJSON;
exports.messageDifferenceFromJSON = messageDifferenceFromJSON;
exports.agentThoughtStreamingEventFunctionFromJSON = agentThoughtStreamingEventFunctionFromJSON;
exports.toolCallsFromJSON = toolCallsFromJSON;
exports.audioFromJSON = audioFromJSON;
exports.agentThoughtStreamingEventMessageFromJSON = agentThoughtStreamingEventMessageFromJSON;
exports.topLogprobsFromJSON = topLogprobsFromJSON;
exports.contentFromJSON = contentFromJSON;
exports.agentThoughtStreamingEventTopLogprobsFromJSON = agentThoughtStreamingEventTopLogprobsFromJSON;
exports.refusalFromJSON = refusalFromJSON;
exports.logprobsFromJSON = logprobsFromJSON;
exports.choiceFromJSON = choiceFromJSON;
exports.agentThoughtStreamingEventPromptTokensDetailsFromJSON = agentThoughtStreamingEventPromptTokensDetailsFromJSON;
exports.agentThoughtStreamingEventCompletionTokensDetailsFromJSON = agentThoughtStreamingEventCompletionTokensDetailsFromJSON;
exports.agentThoughtStreamingEventUsageFromJSON = agentThoughtStreamingEventUsageFromJSON;
exports.agentThoughtStreamingEventDataFromJSON = agentThoughtStreamingEventDataFromJSON;
exports.agentThoughtStreamingEventFromJSON = agentThoughtStreamingEventFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const datapart_js_1 = require("./datapart.js");
const errorpart_js_1 = require("./errorpart.js");
const filepart_js_1 = require("./filepart.js");
const textpart_js_1 = require("./textpart.js");
const toolcallpart_js_1 = require("./toolcallpart.js");
const toolresultpart_js_1 = require("./toolresultpart.js");
exports.AgentThoughtStreamingEventRole = {
    User: "user",
    Agent: "agent",
    Tool: "tool",
    System: "system",
};
/**
 * The reason the model stopped generating tokens.
 */
exports.AgentThoughtStreamingEventFinishReason = {
    Stop: "stop",
    Length: "length",
    ToolCalls: "tool_calls",
    ContentFilter: "content_filter",
    FunctionCall: "function_call",
};
exports.AgentThoughtStreamingEventDataType = {
    Function: "function",
};
exports.AgentThoughtStreamingEventDataRole = {
    Assistant: "assistant",
};
/** @internal */
exports.AgentThoughtStreamingEventRole$inboundSchema = z.nativeEnum(exports.AgentThoughtStreamingEventRole);
/** @internal */
exports.AgentThoughtStreamingEventParts$inboundSchema = z.union([
    textpart_js_1.TextPart$inboundSchema,
    errorpart_js_1.ErrorPart$inboundSchema,
    datapart_js_1.DataPart$inboundSchema,
    filepart_js_1.FilePart$inboundSchema,
    toolcallpart_js_1.ToolCallPart$inboundSchema,
    toolresultpart_js_1.ToolResultPart$inboundSchema,
]);
function agentThoughtStreamingEventPartsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventParts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventParts' from JSON`);
}
/** @internal */
exports.MessageDifference$inboundSchema = z.object({
    messageId: z.string(),
    role: exports.AgentThoughtStreamingEventRole$inboundSchema,
    parts: z.array(z.union([
        textpart_js_1.TextPart$inboundSchema,
        errorpart_js_1.ErrorPart$inboundSchema,
        datapart_js_1.DataPart$inboundSchema,
        filepart_js_1.FilePart$inboundSchema,
        toolcallpart_js_1.ToolCallPart$inboundSchema,
        toolresultpart_js_1.ToolResultPart$inboundSchema,
    ])),
    metadata: z.record(z.any()).optional(),
    agent_id: z.string(),
    agent_execution_id: z.string(),
    workspace_id: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "agent_id": "agentId",
        "agent_execution_id": "agentExecutionId",
        "workspace_id": "workspaceId",
    });
});
function messageDifferenceFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.MessageDifference$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MessageDifference' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventFinishReason$inboundSchema = z.nativeEnum(exports.AgentThoughtStreamingEventFinishReason);
/** @internal */
exports.AgentThoughtStreamingEventDataType$inboundSchema = z.nativeEnum(exports.AgentThoughtStreamingEventDataType);
/** @internal */
exports.AgentThoughtStreamingEventFunction$inboundSchema = z.object({
    name: z.string().optional(),
    arguments: z.string().optional(),
});
function agentThoughtStreamingEventFunctionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventFunction' from JSON`);
}
/** @internal */
exports.ToolCalls$inboundSchema = z.object({
    index: z.number().optional(),
    id: z.string().optional(),
    type: exports.AgentThoughtStreamingEventDataType$inboundSchema.optional(),
    function: z.lazy(() => exports.AgentThoughtStreamingEventFunction$inboundSchema)
        .optional(),
    thought_signature: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "thought_signature": "thoughtSignature",
    });
});
function toolCallsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ToolCalls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolCalls' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventDataRole$inboundSchema = z.nativeEnum(exports.AgentThoughtStreamingEventDataRole);
/** @internal */
exports.Audio$inboundSchema = z
    .object({
    id: z.string(),
    expires_at: z.number().int(),
    data: z.string(),
    transcript: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "expires_at": "expiresAt",
    });
});
function audioFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Audio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Audio' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventMessage$inboundSchema = z.object({
    content: z.nullable(z.string()).optional(),
    refusal: z.nullable(z.string()).optional(),
    tool_calls: z.array(z.lazy(() => exports.ToolCalls$inboundSchema)).optional(),
    role: exports.AgentThoughtStreamingEventDataRole$inboundSchema.optional(),
    reasoning: z.nullable(z.string()).optional(),
    reasoning_signature: z.nullable(z.string()).optional(),
    redacted_reasoning: z.string().optional(),
    audio: z.nullable(z.lazy(() => exports.Audio$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "tool_calls": "toolCalls",
        "reasoning_signature": "reasoningSignature",
        "redacted_reasoning": "redactedReasoning",
    });
});
function agentThoughtStreamingEventMessageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventMessage' from JSON`);
}
/** @internal */
exports.TopLogprobs$inboundSchema = z.object({
    token: z.string(),
    logprob: z.number(),
    bytes: z.nullable(z.array(z.number())),
});
function topLogprobsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.TopLogprobs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TopLogprobs' from JSON`);
}
/** @internal */
exports.Content$inboundSchema = z.object({
    token: z.string(),
    logprob: z.number(),
    bytes: z.nullable(z.array(z.number())),
    top_logprobs: z.array(z.lazy(() => exports.TopLogprobs$inboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "top_logprobs": "topLogprobs",
    });
});
function contentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Content$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Content' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventTopLogprobs$inboundSchema = z.object({
    token: z.string(),
    logprob: z.number(),
    bytes: z.nullable(z.array(z.number())),
});
function agentThoughtStreamingEventTopLogprobsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventTopLogprobs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventTopLogprobs' from JSON`);
}
/** @internal */
exports.Refusal$inboundSchema = z.object({
    token: z.string(),
    logprob: z.number(),
    bytes: z.nullable(z.array(z.number())),
    top_logprobs: z.array(z.lazy(() => exports.AgentThoughtStreamingEventTopLogprobs$inboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "top_logprobs": "topLogprobs",
    });
});
function refusalFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Refusal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Refusal' from JSON`);
}
/** @internal */
exports.Logprobs$inboundSchema = z.object({
    content: z.nullable(z.array(z.lazy(() => exports.Content$inboundSchema))),
    refusal: z.nullable(z.array(z.lazy(() => exports.Refusal$inboundSchema))),
});
function logprobsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Logprobs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Logprobs' from JSON`);
}
/** @internal */
exports.Choice$inboundSchema = z
    .object({
    finish_reason: z.nullable(exports.AgentThoughtStreamingEventFinishReason$inboundSchema),
    index: z.number().default(0),
    message: z.lazy(() => exports.AgentThoughtStreamingEventMessage$inboundSchema),
    logprobs: z.nullable(z.lazy(() => exports.Logprobs$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "finish_reason": "finishReason",
    });
});
function choiceFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Choice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Choice' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventPromptTokensDetails$inboundSchema = z.object({
    cached_tokens: z.nullable(z.number().int()).optional(),
    cache_creation_tokens: z.nullable(z.number().int()).optional(),
    audio_tokens: z.nullable(z.number().int()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "cached_tokens": "cachedTokens",
        "cache_creation_tokens": "cacheCreationTokens",
        "audio_tokens": "audioTokens",
    });
});
function agentThoughtStreamingEventPromptTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventPromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventPromptTokensDetails' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventCompletionTokensDetails$inboundSchema = z.object({
    reasoning_tokens: z.nullable(z.number()).optional(),
    accepted_prediction_tokens: z.nullable(z.number()).optional(),
    rejected_prediction_tokens: z.nullable(z.number()).optional(),
    audio_tokens: z.nullable(z.number().int()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "reasoning_tokens": "reasoningTokens",
        "accepted_prediction_tokens": "acceptedPredictionTokens",
        "rejected_prediction_tokens": "rejectedPredictionTokens",
        "audio_tokens": "audioTokens",
    });
});
function agentThoughtStreamingEventCompletionTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventCompletionTokensDetails' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventUsage$inboundSchema = z.object({
    completion_tokens: z.number().optional(),
    prompt_tokens: z.number().optional(),
    total_tokens: z.number().optional(),
    prompt_tokens_details: z.nullable(z.lazy(() => exports.AgentThoughtStreamingEventPromptTokensDetails$inboundSchema)).optional(),
    completion_tokens_details: z.nullable(z.lazy(() => exports.AgentThoughtStreamingEventCompletionTokensDetails$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "completion_tokens": "completionTokens",
        "prompt_tokens": "promptTokens",
        "total_tokens": "totalTokens",
        "prompt_tokens_details": "promptTokensDetails",
        "completion_tokens_details": "completionTokensDetails",
    });
});
function agentThoughtStreamingEventUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventUsage' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEventData$inboundSchema = z.object({
    agent_id: z.string(),
    message_difference: z.record(z.lazy(() => exports.MessageDifference$inboundSchema)),
    choice: z.lazy(() => exports.Choice$inboundSchema).optional(),
    choiceIndex: z.number().optional(),
    iteration: z.number(),
    accumulated_execution_time: z.number(),
    responseId: z.string().optional(),
    usage: z.lazy(() => exports.AgentThoughtStreamingEventUsage$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "agent_id": "agentId",
        "message_difference": "messageDifference",
        "accumulated_execution_time": "accumulatedExecutionTime",
    });
});
function agentThoughtStreamingEventDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEventData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEventData' from JSON`);
}
/** @internal */
exports.AgentThoughtStreamingEvent$inboundSchema = z.object({
    type: z.literal("event.agents.thought"),
    timestamp: z.string(),
    data: z.lazy(() => exports.AgentThoughtStreamingEventData$inboundSchema),
});
function agentThoughtStreamingEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentThoughtStreamingEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentThoughtStreamingEvent' from JSON`);
}
//# sourceMappingURL=agentthoughtstreamingevent.js.map