"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.AgentStartedStreamingEvent$inboundSchema = exports.AgentStartedStreamingEventData$inboundSchema = exports.AgentSource$inboundSchema = exports.Settings$inboundSchema = exports.Guardrails$inboundSchema = exports.AgentStartedStreamingEventExecuteOn$inboundSchema = exports.Evaluators$inboundSchema = exports.ExecuteOn$inboundSchema = exports.Tools$inboundSchema = exports.AgentStartedStreamingEventConditions$inboundSchema = exports.ToolApprovalRequired$inboundSchema = exports.InputMessage$inboundSchema = exports.AgentStartedStreamingEventParts$inboundSchema = exports.AgentStartedStreamingEventRole$inboundSchema = exports.AgentSource = exports.AgentStartedStreamingEventExecuteOn = exports.ExecuteOn = exports.ToolApprovalRequired = exports.AgentStartedStreamingEventRole = void 0;
exports.agentStartedStreamingEventPartsFromJSON = agentStartedStreamingEventPartsFromJSON;
exports.inputMessageFromJSON = inputMessageFromJSON;
exports.agentStartedStreamingEventConditionsFromJSON = agentStartedStreamingEventConditionsFromJSON;
exports.toolsFromJSON = toolsFromJSON;
exports.evaluatorsFromJSON = evaluatorsFromJSON;
exports.guardrailsFromJSON = guardrailsFromJSON;
exports.settingsFromJSON = settingsFromJSON;
exports.agentStartedStreamingEventDataFromJSON = agentStartedStreamingEventDataFromJSON;
exports.agentStartedStreamingEventFromJSON = agentStartedStreamingEventFromJSON;
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");
/**
 * Extended A2A message role
 */
exports.AgentStartedStreamingEventRole = {
    User: "user",
    Agent: "agent",
    Tool: "tool",
    System: "system",
};
/**
 * If all, the agent will require approval for all tools. If respect_tool, the agent will require approval for tools that have the requires_approval flag set to true. If none, the agent will not require approval for any tools.
 */
exports.ToolApprovalRequired = {
    All: "all",
    RespectTool: "respect_tool",
    None: "none",
};
/**
 * Determines whether the evaluator runs on the agent input (user message) or output (agent response).
 */
exports.ExecuteOn = {
    Input: "input",
    Output: "output",
};
/**
 * Determines whether the evaluator runs on the agent input (user message) or output (agent response).
 */
exports.AgentStartedStreamingEventExecuteOn = {
    Input: "input",
    Output: "output",
};
exports.AgentSource = {
    Internal: "internal",
    External: "external",
    Experiment: "experiment",
};
/** @internal */
exports.AgentStartedStreamingEventRole$inboundSchema = z.nativeEnum(exports.AgentStartedStreamingEventRole);
/** @internal */
exports.AgentStartedStreamingEventParts$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 agentStartedStreamingEventPartsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentStartedStreamingEventParts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentStartedStreamingEventParts' from JSON`);
}
/** @internal */
exports.InputMessage$inboundSchema = z.object({
    messageId: z.string().optional(),
    role: exports.AgentStartedStreamingEventRole$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(),
});
function inputMessageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InputMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InputMessage' from JSON`);
}
/** @internal */
exports.ToolApprovalRequired$inboundSchema = z.nativeEnum(exports.ToolApprovalRequired);
/** @internal */
exports.AgentStartedStreamingEventConditions$inboundSchema = z.object({
    condition: z.string(),
    operator: z.string(),
    value: z.string(),
});
function agentStartedStreamingEventConditionsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentStartedStreamingEventConditions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentStartedStreamingEventConditions' from JSON`);
}
/** @internal */
exports.Tools$inboundSchema = z
    .object({
    id: z.string(),
    key: z.string().optional(),
    action_type: z.string(),
    display_name: z.string().optional(),
    description: z.string().optional(),
    requires_approval: z.boolean().default(false),
    tool_id: z.string().optional(),
    conditions: z.array(z.lazy(() => exports.AgentStartedStreamingEventConditions$inboundSchema)).optional(),
    timeout: z.number().default(120),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "action_type": "actionType",
        "display_name": "displayName",
        "requires_approval": "requiresApproval",
        "tool_id": "toolId",
    });
});
function toolsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Tools$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Tools' from JSON`);
}
/** @internal */
exports.ExecuteOn$inboundSchema = z
    .nativeEnum(exports.ExecuteOn);
/** @internal */
exports.Evaluators$inboundSchema = z.object({
    id: z.string(),
    sample_rate: z.number().default(50),
    execute_on: exports.ExecuteOn$inboundSchema,
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "sample_rate": "sampleRate",
        "execute_on": "executeOn",
    });
});
function evaluatorsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Evaluators$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Evaluators' from JSON`);
}
/** @internal */
exports.AgentStartedStreamingEventExecuteOn$inboundSchema = z.nativeEnum(exports.AgentStartedStreamingEventExecuteOn);
/** @internal */
exports.Guardrails$inboundSchema = z.object({
    id: z.string(),
    sample_rate: z.number().default(50),
    execute_on: exports.AgentStartedStreamingEventExecuteOn$inboundSchema,
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "sample_rate": "sampleRate",
        "execute_on": "executeOn",
    });
});
function guardrailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Guardrails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Guardrails' from JSON`);
}
/** @internal */
exports.Settings$inboundSchema = z.object({
    max_iterations: z.number().int().default(100),
    max_execution_time: z.number().int().default(600),
    max_cost: z.number().default(0),
    tool_approval_required: exports.ToolApprovalRequired$inboundSchema.default("respect_tool"),
    tools: z.array(z.lazy(() => exports.Tools$inboundSchema)).optional(),
    evaluators: z.array(z.lazy(() => exports.Evaluators$inboundSchema)).optional(),
    guardrails: z.array(z.lazy(() => exports.Guardrails$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "max_iterations": "maxIterations",
        "max_execution_time": "maxExecutionTime",
        "max_cost": "maxCost",
        "tool_approval_required": "toolApprovalRequired",
    });
});
function settingsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Settings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Settings' from JSON`);
}
/** @internal */
exports.AgentSource$inboundSchema = z
    .nativeEnum(exports.AgentSource);
/** @internal */
exports.AgentStartedStreamingEventData$inboundSchema = z.object({
    workflowRunId: z.string(),
    integration_id: z.string().optional(),
    inputMessage: z.lazy(() => exports.InputMessage$inboundSchema),
    modelId: z.string(),
    instructions: z.string(),
    system_prompt: z.string(),
    settings: z.lazy(() => exports.Settings$inboundSchema).optional(),
    agent_manifest_id: z.string(),
    agent_key: z.string(),
    agent_description: z.nullable(z.string()).optional(),
    agent_source: z.nullable(exports.AgentSource$inboundSchema).optional(),
    variables: z.record(z.any()).optional(),
    tool_execution_id: z.string().optional(),
    is_continuation: z.boolean().optional(),
    stream: z.boolean().optional(),
    responseId: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "integration_id": "integrationId",
        "system_prompt": "systemPrompt",
        "agent_manifest_id": "agentManifestId",
        "agent_key": "agentKey",
        "agent_description": "agentDescription",
        "agent_source": "agentSource",
        "tool_execution_id": "toolExecutionId",
        "is_continuation": "isContinuation",
    });
});
function agentStartedStreamingEventDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentStartedStreamingEventData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentStartedStreamingEventData' from JSON`);
}
/** @internal */
exports.AgentStartedStreamingEvent$inboundSchema = z.object({
    type: z.literal("event.agents.started"),
    timestamp: z.string(),
    data: z.lazy(() => exports.AgentStartedStreamingEventData$inboundSchema),
});
function agentStartedStreamingEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentStartedStreamingEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentStartedStreamingEvent' from JSON`);
}
//# sourceMappingURL=agentstartedstreamingevent.js.map