'use strict'; var chunk4C5RVGHE_cjs = require('./chunk-4C5RVGHE.cjs'); var chunkPXLC5SNM_cjs = require('./chunk-PXLC5SNM.cjs'); var chunk24YYB3J7_cjs = require('./chunk-24YYB3J7.cjs'); var chunkPFKYMKIH_cjs = require('./chunk-PFKYMKIH.cjs'); var chunkDIG2K5CV_cjs = require('./chunk-DIG2K5CV.cjs'); var v4 = require('zod/v4'); var semanticRecallSchema = v4.z.object({ topK: v4.z.number().describe("Number of semantically similar messages to retrieve"), messageRange: v4.z.union([ v4.z.number(), v4.z.object({ before: v4.z.number(), after: v4.z.number() }) ]).describe("Amount of surrounding context to include with each retrieved message"), scope: v4.z.enum(["thread", "resource"]).optional().describe("Scope for semantic search queries"), threshold: v4.z.number().min(0).max(1).optional().describe("Minimum similarity score threshold"), indexName: v4.z.string().optional().describe("Index name for the vector store") }); var titleGenerationSchema = v4.z.union([ v4.z.boolean(), v4.z.object({ model: v4.z.string().describe("Model ID in format provider/model-name (ModelRouterModelId)"), instructions: v4.z.string().optional().describe("Custom instructions for title generation") }) ]); var serializedObservationConfigSchema = v4.z.object({ model: v4.z.string().optional().describe("Observer model ID"), messageTokens: v4.z.number().optional().describe("Token threshold that triggers observation"), modelSettings: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Model settings (temperature, etc.)"), providerOptions: v4.z.record(v4.z.string(), v4.z.record(v4.z.string(), v4.z.unknown()).optional()).optional().describe("Provider-specific options"), maxTokensPerBatch: v4.z.number().optional().describe("Maximum tokens per batch"), bufferTokens: v4.z.union([v4.z.number(), v4.z.literal(false)]).optional().describe("Async buffering interval or false"), bufferActivation: v4.z.number().optional().describe("Ratio of buffered observations to activate"), blockAfter: v4.z.number().optional().describe("Token threshold for synchronous blocking") }); var serializedReflectionConfigSchema = v4.z.object({ model: v4.z.string().optional().describe("Reflector model ID"), observationTokens: v4.z.number().optional().describe("Token threshold that triggers reflection"), modelSettings: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Model settings (temperature, etc.)"), providerOptions: v4.z.record(v4.z.string(), v4.z.record(v4.z.string(), v4.z.unknown()).optional()).optional().describe("Provider-specific options"), blockAfter: v4.z.number().optional().describe("Token threshold for synchronous blocking"), bufferActivation: v4.z.number().optional().describe("Ratio for async reflection buffering") }); var serializedObservationalMemoryConfigObjectSchema = v4.z.object({ model: v4.z.string().optional().describe("Model ID for both Observer and Reflector"), scope: v4.z.enum(["resource", "thread"]).optional().describe("Memory scope"), shareTokenBudget: v4.z.boolean().optional().describe("Share token budget between messages and observations"), observation: serializedObservationConfigSchema.optional().describe("Observation step configuration"), reflection: serializedReflectionConfigSchema.optional().describe("Reflection step configuration") }); var serializedObservationalMemoryConfigSchema = v4.z.union([ v4.z.boolean(), serializedObservationalMemoryConfigObjectSchema ]); var serializedMemoryConfigSchema = v4.z.object({ vector: v4.z.union([v4.z.string(), v4.z.literal(false)]).optional().describe("Vector database identifier or false to disable"), options: v4.z.object({ readOnly: v4.z.boolean().optional(), lastMessages: v4.z.union([v4.z.number(), v4.z.literal(false)]).optional(), semanticRecall: v4.z.union([v4.z.boolean(), semanticRecallSchema]).optional(), generateTitle: titleGenerationSchema.optional() }).optional().describe("Memory behavior configuration, excluding workingMemory and threads"), embedder: v4.z.string().optional().describe('Embedding model ID in the format "provider/model" (e.g., "openai/text-embedding-3-small")'), embedderOptions: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Options to pass to the embedder, omitting telemetry"), observationalMemory: serializedObservationalMemoryConfigSchema.optional().describe("Serialized observational memory configuration") }).refine( (data) => { const semanticRecall = data.options?.semanticRecall; const semanticRecallEnabled = semanticRecall === true || typeof semanticRecall === "object" && semanticRecall !== null; if (semanticRecallEnabled) { const hasVector = typeof data.vector === "string" && data.vector.length > 0; const hasEmbedder = typeof data.embedder === "string" && data.embedder.length > 0; return hasVector && hasEmbedder; } return true; }, { message: "Semantic recall requires both vector and embedder to be configured", path: ["options", "semanticRecall"] } ); var storedAgentIdPathParams = v4.z.object({ storedAgentId: v4.z.string().describe("Unique identifier for the stored agent") }); var storageOrderBySchema = v4.z.object({ field: v4.z.enum(["createdAt", "updatedAt"]).optional(), direction: v4.z.enum(["ASC", "DESC"]).optional() }); var listStoredAgentsQuerySchema = chunkDIG2K5CV_cjs.createPagePaginationSchema(100).extend({ orderBy: storageOrderBySchema.optional(), status: v4.z.enum(["draft", "published", "archived"]).optional().default("published").describe("Filter agents by status (defaults to published)"), authorId: v4.z.string().optional().describe("Filter agents by author identifier"), visibility: v4.z.enum(["public"]).optional().describe("Filter to only public agents"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Filter agents by metadata key-value pairs"), favoritedOnly: v4.z.stringbool().optional().describe("When true, return only agents favorited by the caller (requires the `favorites` EE feature)"), pinFavoritedFor: v4.z.string().optional().describe( "When set, treat the given subject (user/role) as the favoriting principal for `favoritedOnly` instead of the caller" ) }); var scorerConfigSchema = v4.z.object({ description: v4.z.string().optional(), sampling: v4.z.union([ v4.z.object({ type: v4.z.literal("none") }), v4.z.object({ type: v4.z.literal("ratio"), rate: v4.z.number().min(0).max(1) }) ]).optional(), rules: chunk24YYB3J7_cjs.ruleGroupSchema.optional() }); var agentInstructionBlockSchema = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("text"), content: v4.z.string() }), v4.z.object({ type: v4.z.literal("prompt_block_ref"), id: v4.z.string() }), v4.z.object({ type: v4.z.literal("prompt_block"), content: v4.z.string(), rules: chunk24YYB3J7_cjs.ruleGroupSchema.optional() }) ]); function conditionalFieldSchema(valueSchema) { const variantSchema = v4.z.object({ value: valueSchema, rules: chunk24YYB3J7_cjs.ruleGroupSchema.optional() }); return v4.z.union([valueSchema, v4.z.array(variantSchema)]); } var instructionsSchema = v4.z.union([v4.z.string(), v4.z.array(agentInstructionBlockSchema)]).describe("System instructions for the agent (string or array of instruction blocks)"); var modelConfigSchema = v4.z.object({ provider: v4.z.string().describe("Model provider (e.g., openai, anthropic)"), name: v4.z.string().describe("Model name (e.g., gpt-4o, claude-3-opus)") }).passthrough(); var toolConfigSchema = v4.z.object({ description: v4.z.string().optional(), rules: chunk24YYB3J7_cjs.ruleGroupSchema.optional() }); var toolsConfigSchema = v4.z.record(v4.z.string(), toolConfigSchema); var mcpClientToolsConfigSchema = v4.z.object({ tools: v4.z.record(v4.z.string(), toolConfigSchema).optional() }); var skillConfigSchema = v4.z.object({ description: v4.z.string().optional(), instructions: v4.z.string().optional(), pin: v4.z.string().optional(), strategy: v4.z.enum(["latest", "live"]).optional() }); var skillsConfigSchema = v4.z.record(v4.z.string(), skillConfigSchema); var workspaceRefSchema = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("id"), workspaceId: v4.z.string() }), v4.z.object({ type: v4.z.literal("inline"), config: chunk4C5RVGHE_cjs.snapshotConfigSchema }) ]); var screencastOptionsSchema = v4.z.object({ format: v4.z.enum(["jpeg", "png"]).optional().describe("Image format (default: jpeg)"), quality: v4.z.number().min(0).max(100).optional().describe("JPEG quality 0-100 (default: 80)"), maxWidth: v4.z.number().optional().describe("Max width in pixels (default: 1280)"), maxHeight: v4.z.number().optional().describe("Max height in pixels (default: 720)"), everyNthFrame: v4.z.number().optional().describe("Capture every Nth frame (default: 1)") }); var browserConfigSchema = v4.z.object({ provider: v4.z.string().describe("Browser provider type (e.g., stagehand, playwright)"), headless: v4.z.boolean().optional().describe("Run browser in headless mode (default: true)"), viewport: v4.z.object({ width: v4.z.number().describe("Viewport width in pixels"), height: v4.z.number().describe("Viewport height in pixels") }).optional().describe("Browser viewport dimensions"), timeout: v4.z.number().optional().describe("Default timeout in milliseconds (default: 10000)"), screencast: screencastOptionsSchema.optional().describe("Screencast options for streaming browser frames") }); var browserRefSchema = v4.z.object({ type: v4.z.literal("inline"), config: browserConfigSchema }); var processorPhaseSchema = v4.z.enum([ "processInput", "processInputStep", "processOutputStream", "processOutputResult", "processOutputStep" ]); var processorGraphStepSchema = v4.z.object({ id: v4.z.string().describe("Unique ID for this step within the graph"), providerId: v4.z.string().describe("ProcessorProvider ID that creates this processor"), config: v4.z.record(v4.z.string(), v4.z.unknown()).describe("Configuration matching the provider configSchema"), enabledPhases: v4.z.array(processorPhaseSchema).min(1).describe("Which processor phases to enable") }); var processorGraphEntryDepth3 = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("step"), step: processorGraphStepSchema }) ]); var processorGraphEntryDepth2 = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("step"), step: processorGraphStepSchema }), v4.z.object({ type: v4.z.literal("parallel"), branches: v4.z.array(v4.z.array(processorGraphEntryDepth3)) }), v4.z.object({ type: v4.z.literal("conditional"), conditions: v4.z.array( v4.z.object({ steps: v4.z.array(processorGraphEntryDepth3), rules: chunk24YYB3J7_cjs.ruleGroupSchema.optional() }) ) }) ]); var processorGraphEntrySchema = v4.z.discriminatedUnion("type", [ v4.z.object({ type: v4.z.literal("step"), step: processorGraphStepSchema }), v4.z.object({ type: v4.z.literal("parallel"), branches: v4.z.array(v4.z.array(processorGraphEntryDepth2)) }), v4.z.object({ type: v4.z.literal("conditional"), conditions: v4.z.array( v4.z.object({ steps: v4.z.array(processorGraphEntryDepth2), rules: chunk24YYB3J7_cjs.ruleGroupSchema.optional() }) ) }) ]); var storedProcessorGraphSchema = v4.z.object({ steps: v4.z.array(processorGraphEntrySchema).describe("Ordered list of processor graph entries") }); var snapshotConfigSchema2 = v4.z.object({ name: v4.z.string().describe("Name of the agent"), description: v4.z.string().optional().describe("Description of the agent"), instructions: instructionsSchema, model: conditionalFieldSchema(modelConfigSchema).describe( "Model configuration \u2014 static value or array of conditional variants" ), tools: conditionalFieldSchema(toolsConfigSchema).optional().describe("Tool keys mapped to per-tool config \u2014 static or conditional"), defaultOptions: conditionalFieldSchema(chunkPFKYMKIH_cjs.defaultOptionsSchema).optional().describe("Default options for generate/stream calls \u2014 static or conditional"), workflows: conditionalFieldSchema(v4.z.record(v4.z.string(), toolConfigSchema)).optional().describe("Workflow keys with optional per-workflow config \u2014 static or conditional"), agents: conditionalFieldSchema(v4.z.record(v4.z.string(), toolConfigSchema)).optional().describe("Agent keys with optional per-agent config \u2014 static or conditional"), integrationTools: conditionalFieldSchema(v4.z.record(v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of tool provider IDs to their tool configurations \u2014 static or conditional"), toolProviders: conditionalFieldSchema(chunkPXLC5SNM_cjs.toolProvidersSchema).optional().describe( "Tool provider connections and per-tool config (provider-agnostic). Coexists with the deprecated `integrationTools` field." ), mcpClients: conditionalFieldSchema(v4.z.record(v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of stored MCP client IDs to their tool configurations \u2014 static or conditional"), inputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Input processor graph \u2014 static or conditional"), outputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Output processor graph \u2014 static or conditional"), memory: conditionalFieldSchema(serializedMemoryConfigSchema).optional().describe("Memory configuration \u2014 static or conditional"), scorers: conditionalFieldSchema(v4.z.record(v4.z.string(), scorerConfigSchema)).optional().describe("Scorer keys with optional sampling config \u2014 static or conditional"), skills: conditionalFieldSchema(skillsConfigSchema).optional().describe("Skill IDs mapped to per-skill config \u2014 static or conditional"), workspace: conditionalFieldSchema(workspaceRefSchema).optional().describe("Workspace reference (stored ID or inline config) \u2014 static or conditional"), browser: v4.z.union([conditionalFieldSchema(browserRefSchema), v4.z.boolean(), v4.z.null()]).optional().describe("Browser configuration \u2014 object config, true (apply default), false/null (disable)"), requestContextSchema: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("JSON Schema defining valid request context variables for conditional rule evaluation") }); var agentMetadataSchema = v4.z.object({ authorId: v4.z.string().optional().describe("Author identifier for multi-tenant filtering"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Additional metadata for the agent"), visibility: v4.z.enum(["private", "public"]).optional().describe("Agent visibility: private (owner/admin only) or public (any reader)") }); var snapshotConfigCreateSchema = snapshotConfigSchema2.extend({ model: conditionalFieldSchema(modelConfigSchema).optional().describe( "Model configuration \u2014 static value or array of conditional variants. When omitted, the builder default model is applied server-side." ) }); var createStoredAgentBodySchema = v4.z.object({ id: v4.z.string().optional().describe("Unique identifier for the agent. If not provided, derived from name."), authorId: v4.z.string().optional().describe("Author identifier for multi-tenant filtering"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("Additional metadata for the agent"), visibility: v4.z.enum(["private", "public"]).optional().describe("Agent visibility: private (owner/admin only) or public (any reader)") }).merge(snapshotConfigCreateSchema); var snapshotConfigUpdateSchema = snapshotConfigSchema2.extend({ memory: v4.z.union([conditionalFieldSchema(serializedMemoryConfigSchema), v4.z.null()]).optional().describe("Memory configuration \u2014 static, conditional, or null to disable memory") }); var updateStoredAgentBodySchema = agentMetadataSchema.partial().merge(snapshotConfigUpdateSchema.partial()).extend({ changeMessage: v4.z.string().trim().max(500).optional().describe("Optional message describing the changes for the auto-created version") }); var exportStoredAgentBodySchema = snapshotConfigUpdateSchema.partial(); var openStoredAgentChangeRequestBodySchema = exportStoredAgentBodySchema.extend({ changeMessage: v4.z.string().trim().max(500).optional(), userName: v4.z.string().trim().min(1).max(120).optional(), inspectOnly: v4.z.boolean().optional() }); var resolvedAuthorSchema = v4.z.object({ id: v4.z.string(), name: v4.z.string().optional(), email: v4.z.string().optional(), avatarUrl: v4.z.string().optional() }); var storedAgentSchema = v4.z.object({ // Thin agent record fields id: v4.z.string(), status: v4.z.string().describe("Agent status: draft or published"), activeVersionId: v4.z.string().optional(), authorId: v4.z.string().optional(), author: resolvedAuthorSchema.optional().describe("Resolved author identity (when an auth provider is configured)"), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional(), visibility: v4.z.enum(["private", "public"]).optional(), favoriteCount: v4.z.number().int().nonnegative().optional().describe("Number of users who have favorited this agent"), isFavorited: v4.z.boolean().optional().describe("Whether the requesting user has favorited this agent"), createdAt: v4.z.coerce.date(), updatedAt: v4.z.coerce.date(), // Version snapshot config fields (resolved from active version) name: v4.z.string().describe("Name of the agent"), description: v4.z.string().optional().describe("Description of the agent"), instructions: instructionsSchema, model: conditionalFieldSchema(modelConfigSchema).describe( "Model configuration \u2014 static value or array of conditional variants" ), tools: conditionalFieldSchema(toolsConfigSchema).optional().describe("Tool keys mapped to per-tool config \u2014 static or conditional"), defaultOptions: conditionalFieldSchema(chunkPFKYMKIH_cjs.defaultOptionsSchema).optional().describe("Default options for generate/stream calls \u2014 static or conditional"), workflows: conditionalFieldSchema(v4.z.record(v4.z.string(), toolConfigSchema)).optional().describe("Workflow keys with optional per-workflow config \u2014 static or conditional"), agents: conditionalFieldSchema(v4.z.record(v4.z.string(), toolConfigSchema)).optional().describe("Agent keys with optional per-agent config \u2014 static or conditional"), integrationTools: conditionalFieldSchema(v4.z.record(v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of tool provider IDs to their tool configurations \u2014 static or conditional"), toolProviders: conditionalFieldSchema(chunkPXLC5SNM_cjs.toolProvidersSchema).optional().describe( "Tool provider connections and per-tool config (provider-agnostic). Coexists with the deprecated `integrationTools` field." ), mcpClients: conditionalFieldSchema(v4.z.record(v4.z.string(), mcpClientToolsConfigSchema)).optional().describe("Map of stored MCP client IDs to their tool configurations \u2014 static or conditional"), inputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Input processor graph \u2014 static or conditional"), outputProcessors: conditionalFieldSchema(storedProcessorGraphSchema).optional().describe("Output processor graph \u2014 static or conditional"), memory: conditionalFieldSchema(serializedMemoryConfigSchema).optional().describe("Memory configuration \u2014 static or conditional"), scorers: conditionalFieldSchema(v4.z.record(v4.z.string(), scorerConfigSchema)).optional().describe("Scorer keys with optional sampling config \u2014 static or conditional"), skills: conditionalFieldSchema(skillsConfigSchema).optional().describe("Skill IDs mapped to per-skill config \u2014 static or conditional"), workspace: conditionalFieldSchema(workspaceRefSchema).optional().describe("Workspace reference (stored ID or inline config) \u2014 static or conditional"), browser: v4.z.union([conditionalFieldSchema(browserRefSchema), v4.z.boolean(), v4.z.null()]).optional().describe("Browser configuration \u2014 object config, true (apply default), false/null (disable)"), requestContextSchema: v4.z.record(v4.z.string(), v4.z.unknown()).optional().describe("JSON Schema defining valid request context variables") }); var listStoredAgentsResponseSchema = chunkDIG2K5CV_cjs.paginationInfoSchema.extend({ agents: v4.z.array(storedAgentSchema) }); var getStoredAgentResponseSchema = storedAgentSchema; var createStoredAgentResponseSchema = storedAgentSchema; var updateStoredAgentResponseSchema = v4.z.union([ // Thin agent record (no version config) v4.z.object({ id: v4.z.string(), status: v4.z.string(), activeVersionId: v4.z.string().optional(), authorId: v4.z.string().optional(), metadata: v4.z.record(v4.z.string(), v4.z.unknown()).optional(), visibility: v4.z.enum(["private", "public"]).optional(), createdAt: v4.z.coerce.date(), updatedAt: v4.z.coerce.date() }), // Resolved agent (thin record + version config) storedAgentSchema ]); var deleteStoredAgentResponseSchema = v4.z.object({ success: v4.z.boolean(), message: v4.z.string() }); var getStoredAgentDependentsResponseSchema = v4.z.object({ dependents: v4.z.array( v4.z.object({ id: v4.z.string(), name: v4.z.string() }) ), hiddenCount: v4.z.number().int().nonnegative() }); var exportStoredAgentResponseSchema = v4.z.object({ agentId: v4.z.string(), fileName: v4.z.string(), content: v4.z.string(), config: v4.z.record(v4.z.string(), v4.z.unknown()) }); var openStoredAgentChangeRequestResponseSchema = v4.z.object({ id: v4.z.union([v4.z.string(), v4.z.number()]).optional(), url: v4.z.string(), ref: v4.z.string().optional() }); var previewInstructionsBodySchema = v4.z.object({ blocks: v4.z.array(agentInstructionBlockSchema).describe("Array of instruction blocks to resolve"), context: v4.z.record(v4.z.string(), v4.z.unknown()).optional().default({}).describe("Request context for variable interpolation and rule evaluation") }); var previewInstructionsResponseSchema = v4.z.object({ result: v4.z.string().describe("The resolved instructions string") }); exports.conditionalFieldSchema = conditionalFieldSchema; exports.createStoredAgentBodySchema = createStoredAgentBodySchema; exports.createStoredAgentResponseSchema = createStoredAgentResponseSchema; exports.deleteStoredAgentResponseSchema = deleteStoredAgentResponseSchema; exports.exportStoredAgentBodySchema = exportStoredAgentBodySchema; exports.exportStoredAgentResponseSchema = exportStoredAgentResponseSchema; exports.getStoredAgentDependentsResponseSchema = getStoredAgentDependentsResponseSchema; exports.getStoredAgentResponseSchema = getStoredAgentResponseSchema; exports.instructionsSchema = instructionsSchema; exports.listStoredAgentsQuerySchema = listStoredAgentsQuerySchema; exports.listStoredAgentsResponseSchema = listStoredAgentsResponseSchema; exports.modelConfigSchema = modelConfigSchema; exports.openStoredAgentChangeRequestBodySchema = openStoredAgentChangeRequestBodySchema; exports.openStoredAgentChangeRequestResponseSchema = openStoredAgentChangeRequestResponseSchema; exports.previewInstructionsBodySchema = previewInstructionsBodySchema; exports.previewInstructionsResponseSchema = previewInstructionsResponseSchema; exports.processorGraphEntrySchema = processorGraphEntrySchema; exports.processorGraphStepSchema = processorGraphStepSchema; exports.processorPhaseSchema = processorPhaseSchema; exports.resolvedAuthorSchema = resolvedAuthorSchema; exports.scorerConfigSchema = scorerConfigSchema; exports.semanticRecallSchema = semanticRecallSchema; exports.serializedMemoryConfigSchema = serializedMemoryConfigSchema; exports.serializedObservationConfigSchema = serializedObservationConfigSchema; exports.serializedObservationalMemoryConfigObjectSchema = serializedObservationalMemoryConfigObjectSchema; exports.serializedObservationalMemoryConfigSchema = serializedObservationalMemoryConfigSchema; exports.serializedReflectionConfigSchema = serializedReflectionConfigSchema; exports.snapshotConfigSchema = snapshotConfigSchema2; exports.storedAgentIdPathParams = storedAgentIdPathParams; exports.storedAgentSchema = storedAgentSchema; exports.storedProcessorGraphSchema = storedProcessorGraphSchema; exports.titleGenerationSchema = titleGenerationSchema; exports.toolConfigSchema = toolConfigSchema; exports.toolsConfigSchema = toolsConfigSchema; exports.updateStoredAgentBodySchema = updateStoredAgentBodySchema; exports.updateStoredAgentResponseSchema = updateStoredAgentResponseSchema; //# sourceMappingURL=chunk-TIWGWGIO.cjs.map //# sourceMappingURL=chunk-TIWGWGIO.cjs.map