@mastra/server 1.57.0-alpha.1 → 1.57.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/CHANGELOG.md +48 -0
- package/dist/_types/@internal_core/dist/storage/index.d.ts +2 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +4 -1
- package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +16 -217
- package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-v6/dist/index.d.ts +31 -378
- package/dist/{a2a-CE7HKP5V.cjs → a2a-DKnwIgiw.cjs} +2 -2
- package/dist/{a2a-CE7HKP5V.cjs.map → a2a-DKnwIgiw.cjs.map} +1 -1
- package/dist/{a2a-_3LYIc9y.js → a2a-uPi5sPwb.js} +2 -2
- package/dist/{a2a-_3LYIc9y.js.map → a2a-uPi5sPwb.js.map} +1 -1
- package/dist/{agent-versions-DC1Rp5EP.js → agent-versions-Bsrpa_zb.js} +2 -2
- package/dist/{agent-versions-DC1Rp5EP.js.map → agent-versions-Bsrpa_zb.js.map} +1 -1
- package/dist/{agent-versions-DhkWMz0z.cjs → agent-versions-CdQGF-3e.cjs} +2 -2
- package/dist/{agent-versions-DhkWMz0z.cjs.map → agent-versions-CdQGF-3e.cjs.map} +1 -1
- package/dist/{agents-DD4PJgsF.js → agents-CYvun9iI.js} +12 -7
- package/dist/agents-CYvun9iI.js.map +1 -0
- package/dist/{agents-B9ofSVSn.cjs → agents-Dk2qoJi_.cjs} +12 -7
- package/dist/agents-Dk2qoJi_.cjs.map +1 -0
- package/dist/{api-schema-manifest-Ba-Ssw4H.cjs → api-schema-manifest-7-NC9Dyc.cjs} +2 -2
- package/dist/{api-schema-manifest-Ba-Ssw4H.cjs.map → api-schema-manifest-7-NC9Dyc.cjs.map} +1 -1
- package/dist/{api-schema-manifest-DbTP-DpV.js → api-schema-manifest-C5hpdIE_.js} +2 -2
- package/dist/{api-schema-manifest-DbTP-DpV.js.map → api-schema-manifest-C5hpdIE_.js.map} +1 -1
- package/dist/{builder-registry-C_PysvMI.cjs → builder-registry-BoaXBdm_.cjs} +2 -2
- package/dist/{builder-registry-C_PysvMI.cjs.map → builder-registry-BoaXBdm_.cjs.map} +1 -1
- package/dist/{builder-registry-DaPvPspl.js → builder-registry-DE5w7bNk.js} +2 -2
- package/dist/{builder-registry-DaPvPspl.js.map → builder-registry-DE5w7bNk.js.map} +1 -1
- package/dist/{dist-DhFw0bEW.cjs → dist-COHIL6fR.cjs} +156 -46
- package/dist/dist-COHIL6fR.cjs.map +1 -0
- package/dist/{dist-DRyzA92e.js → dist-DGqlUp0b.js} +156 -46
- package/dist/dist-DGqlUp0b.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-server-routes.md +13 -0
- package/dist/{editor-builder-ByNr3nc9.cjs → editor-builder-BW4nlDcX.cjs} +2 -2
- package/dist/{editor-builder-ByNr3nc9.cjs.map → editor-builder-BW4nlDcX.cjs.map} +1 -1
- package/dist/{editor-builder-DZRQf2UD.cjs → editor-builder-CWTGCtNu.cjs} +2 -2
- package/dist/{editor-builder-DZRQf2UD.cjs.map → editor-builder-CWTGCtNu.cjs.map} +1 -1
- package/dist/{editor-builder-CW9Tcqg1.js → editor-builder-Ct2nIbum.js} +2 -2
- package/dist/{editor-builder-CW9Tcqg1.js.map → editor-builder-Ct2nIbum.js.map} +1 -1
- package/dist/{editor-builder-XFcH8gX0.js → editor-builder-fKbRRlK_.js} +2 -2
- package/dist/{editor-builder-XFcH8gX0.js.map → editor-builder-fKbRRlK_.js.map} +1 -1
- package/dist/{observability-new-endpoints-DFBDedGH.cjs → observability-new-endpoints-Dk3oatL8.cjs} +3 -1
- package/dist/observability-new-endpoints-Dk3oatL8.cjs.map +1 -0
- package/dist/{observability-new-endpoints-CCyqX1Ra.js → observability-new-endpoints-YK2DjZto.js} +3 -1
- package/dist/observability-new-endpoints-YK2DjZto.js.map +1 -0
- package/dist/{processor-providers-BmOA_jeU.js → processor-providers-DBhZC6-4.js} +3 -2
- package/dist/processor-providers-DBhZC6-4.js.map +1 -0
- package/dist/{processor-providers-DGBNerTY.cjs → processor-providers-DHvTA9AL.cjs} +3 -2
- package/dist/processor-providers-DHvTA9AL.cjs.map +1 -0
- package/dist/{processors-05Z4P9eW.js → processors-88oJ_4J-.js} +7 -4
- package/dist/processors-88oJ_4J-.js.map +1 -0
- package/dist/{processors-BirBp7z3.cjs → processors-D6lRjS0e.cjs} +7 -4
- package/dist/processors-D6lRjS0e.cjs.map +1 -0
- package/dist/route-builder-CIk5k35M.js.map +1 -1
- package/dist/route-builder-CgLVYL1c.cjs.map +1 -1
- package/dist/{routes-CN8wYsyr.js → routes-CRoTKPvQ.js} +5 -5
- package/dist/{routes-CN8wYsyr.js.map → routes-CRoTKPvQ.js.map} +1 -1
- package/dist/{routes-2WgTU1wN.cjs → routes-hSY4wTeS.cjs} +5 -5
- package/dist/{routes-2WgTU1wN.cjs.map → routes-hSY4wTeS.cjs.map} +1 -1
- package/dist/{scorer-versions-BoAERQxp.js → scorer-versions-BA8N488c.js} +2 -2
- package/dist/{scorer-versions-BoAERQxp.js.map → scorer-versions-BA8N488c.js.map} +1 -1
- package/dist/{scorer-versions-DX81YG5X.cjs → scorer-versions-DpmAJKsY.cjs} +2 -2
- package/dist/{scorer-versions-DX81YG5X.cjs.map → scorer-versions-DpmAJKsY.cjs.map} +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +3 -3
- package/dist/server/handlers/agent-builder.js +3 -3
- package/dist/server/handlers/agent-versions.cjs +2 -2
- package/dist/server/handlers/agent-versions.d.ts +224 -112
- package/dist/server/handlers/agent-versions.d.ts.map +1 -1
- package/dist/server/handlers/agent-versions.js +2 -2
- package/dist/server/handlers/agents.cjs +3 -3
- package/dist/server/handlers/agents.d.ts +56 -28
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +3 -3
- package/dist/server/handlers/builder-registry.cjs +1 -1
- package/dist/server/handlers/builder-registry.js +1 -1
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/mcp-client-versions.cjs +1 -1
- package/dist/server/handlers/mcp-client-versions.js +1 -1
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability.cjs +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/processor-providers.cjs +1 -1
- package/dist/server/handlers/processor-providers.d.ts +4 -2
- package/dist/server/handlers/processor-providers.d.ts.map +1 -1
- package/dist/server/handlers/processor-providers.js +1 -1
- package/dist/server/handlers/processors.cjs +17 -2
- package/dist/server/handlers/processors.cjs.map +1 -1
- package/dist/server/handlers/processors.d.ts +6 -2
- package/dist/server/handlers/processors.d.ts.map +1 -1
- package/dist/server/handlers/processors.js +17 -2
- package/dist/server/handlers/processors.js.map +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +1 -1
- package/dist/server/handlers/prompt-block-versions.js +1 -1
- package/dist/server/handlers/schedules.d.ts +16 -16
- package/dist/server/handlers/scorer-versions.cjs +2 -2
- package/dist/server/handlers/scorer-versions.js +2 -2
- package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
- package/dist/server/handlers/stored-agent-favorites.js +3 -3
- package/dist/server/handlers/stored-agents.cjs +3 -3
- package/dist/server/handlers/stored-agents.d.ts +224 -56
- package/dist/server/handlers/stored-agents.d.ts.map +1 -1
- package/dist/server/handlers/stored-agents.js +3 -3
- package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
- package/dist/server/handlers/stored-mcp-clients.js +1 -1
- package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
- package/dist/server/handlers/stored-prompt-blocks.js +1 -1
- package/dist/server/handlers/stored-scorers.cjs +2 -2
- package/dist/server/handlers/stored-scorers.js +2 -2
- package/dist/server/handlers/stored-skill-favorites.cjs +2 -2
- package/dist/server/handlers/stored-skill-favorites.js +2 -2
- package/dist/server/handlers/stored-skills.cjs +2 -2
- package/dist/server/handlers/stored-skills.js +2 -2
- package/dist/server/handlers/stored-workspaces.cjs +1 -1
- package/dist/server/handlers/stored-workspaces.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +2 -2
- package/dist/server/handlers/tools.js +2 -2
- package/dist/server/handlers/workflows.cjs +2 -2
- package/dist/server/handlers/workflows.js +2 -2
- package/dist/server/handlers.cjs +1 -1
- package/dist/server/handlers.js +1 -1
- package/dist/server/schemas/agent-versions.d.ts +140 -0
- package/dist/server/schemas/agent-versions.d.ts.map +1 -1
- package/dist/server/schemas/agents.d.ts +60 -20
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +8 -8
- package/dist/server/schemas/index.js +8 -8
- package/dist/server/schemas/processor-providers.d.ts +2 -0
- package/dist/server/schemas/processor-providers.d.ts.map +1 -1
- package/dist/server/schemas/processors.d.ts +4 -0
- package/dist/server/schemas/processors.d.ts.map +1 -1
- package/dist/server/schemas/schedules.d.ts +5 -5
- package/dist/server/schemas/stored-agents.d.ts +296 -0
- package/dist/server/schemas/stored-agents.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +2 -2
- package/dist/server/server-adapter/index.js +2 -2
- package/dist/server/server-adapter/routes/processor-providers.d.ts +4 -2
- package/dist/server/server-adapter/routes/processor-providers.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/processors.d.ts +6 -2
- package/dist/server/server-adapter/routes/processors.d.ts.map +1 -1
- package/dist/{stored-agents-GBSl2bkv.js → stored-agents-D8ar1Pn7.js} +3 -2
- package/dist/stored-agents-D8ar1Pn7.js.map +1 -0
- package/dist/{stored-agents-DR_L2wPJ.cjs → stored-agents-DKd89v5z.cjs} +3 -2
- package/dist/stored-agents-DKd89v5z.cjs.map +1 -0
- package/dist/{stored-scorers-0eeoiKkg.js → stored-scorers-BIKumDRO.js} +2 -2
- package/dist/{stored-scorers-0eeoiKkg.js.map → stored-scorers-BIKumDRO.js.map} +1 -1
- package/dist/{stored-scorers-CMHNFquG.cjs → stored-scorers-_dqFdh-G.cjs} +2 -2
- package/dist/{stored-scorers-CMHNFquG.cjs.map → stored-scorers-_dqFdh-G.cjs.map} +1 -1
- package/dist/{utils-qxLrCsRx.js → utils-BUK03Frl.js} +3 -2
- package/dist/{utils-qxLrCsRx.js.map → utils-BUK03Frl.js.map} +1 -1
- package/dist/{utils-xsPNtHk8.cjs → utils-wESuBh27.cjs} +3 -2
- package/dist/{utils-xsPNtHk8.cjs.map → utils-wESuBh27.cjs.map} +1 -1
- package/package.json +10 -10
- package/dist/agents-B9ofSVSn.cjs.map +0 -1
- package/dist/agents-DD4PJgsF.js.map +0 -1
- package/dist/dist-DRyzA92e.js.map +0 -1
- package/dist/dist-DhFw0bEW.cjs.map +0 -1
- package/dist/observability-new-endpoints-CCyqX1Ra.js.map +0 -1
- package/dist/observability-new-endpoints-DFBDedGH.cjs.map +0 -1
- package/dist/processor-providers-BmOA_jeU.js.map +0 -1
- package/dist/processor-providers-DGBNerTY.cjs.map +0 -1
- package/dist/processors-05Z4P9eW.js.map +0 -1
- package/dist/processors-BirBp7z3.cjs.map +0 -1
- package/dist/stored-agents-DR_L2wPJ.cjs.map +0 -1
- package/dist/stored-agents-GBSl2bkv.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processors.js","names":[],"sources":["../../../src/server/handlers/processors.ts"],"sourcesContent":["import { MessageList } from '@mastra/core/agent';\nimport type { MessageInput } from '@mastra/core/agent/message-list';\nimport { isProcessorWorkflow } from '@mastra/core/processors';\nimport type { Processor, ProcessorWorkflow } from '@mastra/core/processors';\n\nimport { HTTPException } from '../http-exception';\nimport {\n listProcessorsResponseSchema,\n serializedProcessorDetailSchema,\n processorIdPathParams,\n executeProcessorBodySchema,\n executeProcessorResponseSchema,\n} from '../schemas/processors';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\ntype ProcessorPhase = 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep';\n\n/**\n * Helper to extract text from messages for outputStep testing.\n * In real usage, the `text` field contains the assistant's response text.\n */\nfunction extractTextFromMessages(messages: unknown[]): string {\n if (!messages || !Array.isArray(messages) || messages.length === 0) {\n return '';\n }\n const firstMessage = messages[0] as any;\n if (firstMessage?.content?.parts) {\n const textParts = firstMessage.content.parts\n .filter((part: any) => part?.type === 'text')\n .map((part: any) => part?.text || '');\n return textParts.join('');\n }\n return '';\n}\n\n/**\n * Helper to detect phases for a processor.\n * For individual processors, checks which methods are implemented.\n * For workflow processors, returns all phases since createStep handles each phase\n * and it's a no-op if the underlying processor doesn't implement it.\n */\nfunction detectProcessorPhases(processor: any): ProcessorPhase[] {\n // Check if it's a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Workflow processors can potentially handle all phases\n // The createStep in workflows handles each phase and it's a no-op if not implemented\n return ['input', 'inputStep', 'outputStream', 'outputResult', 'outputStep'];\n }\n\n // For individual processors, detect by checking which methods exist\n const phases: ProcessorPhase[] = [];\n if (typeof processor.processInput === 'function') {\n phases.push('input');\n }\n if (typeof processor.processInputStep === 'function') {\n phases.push('inputStep');\n }\n if (typeof processor.processOutputStream === 'function') {\n phases.push('outputStream');\n }\n if (typeof processor.processOutputResult === 'function') {\n phases.push('outputResult');\n }\n if (typeof processor.processOutputStep === 'function') {\n phases.push('outputStep');\n }\n return phases;\n}\n\nexport const LIST_PROCESSORS_ROUTE = createRoute({\n method: 'GET',\n path: '/processors',\n responseType: 'json',\n responseSchema: listProcessorsResponseSchema,\n summary: 'List all processors',\n description: 'Returns a list of all available individual processors',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const processors = mastra.listProcessors() || {};\n const processorConfigurations = mastra.listProcessorConfigurations();\n const result: Record<\n string,\n {\n id: string;\n name?: string;\n description?: string;\n phases: ProcessorPhase[];\n agentIds: string[];\n configurations: Array<{ agentId: string; type: 'input' | 'output' }>;\n isWorkflow: boolean;\n }\n > = {};\n\n // Iterate through all individual processors registered with Mastra\n for (const [processorKey, processorEntry] of Object.entries(processors)) {\n const processor = processorEntry as Processor | ProcessorWorkflow;\n const processorId = processor.id || processorKey;\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processor);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processor);\n\n // Get agent configurations for this processor\n const configs = processorConfigurations.get(processorId) || [];\n const agentIds = [...new Set(configs.map(c => c.agentId))];\n const configurations = configs.map(c => ({ agentId: c.agentId, type: c.type }));\n\n result[processorId] = {\n id: processorId,\n name: processor.name || processorId,\n description: processor.description,\n phases,\n agentIds,\n configurations,\n isWorkflow,\n };\n }\n\n return result;\n } catch (error) {\n return handleError(error, 'Error getting processors');\n }\n },\n});\n\nexport const GET_PROCESSOR_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/processors/:processorId',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n responseSchema: serializedProcessorDetailSchema,\n summary: 'Get processor by ID',\n description: 'Returns details for a specific processor including its phases and configurations',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId }) => {\n try {\n // Get the processor from Mastra's registered processors\n let processorEntry: Processor | ProcessorWorkflow | undefined;\n try {\n processorEntry = mastra.getProcessorById(processorId) as Processor | ProcessorWorkflow;\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processorEntry = processors[processorId as keyof typeof processors] as Processor | ProcessorWorkflow;\n }\n\n if (!processorEntry) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processorEntry);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processorEntry);\n\n // Get agent configurations for this processor\n const configs = mastra.getProcessorConfigurations(processorId);\n const agents = mastra.listAgents() || {};\n const configurations = configs.map(c => ({\n agentId: c.agentId,\n agentName: agents[c.agentId]?.name || c.agentId,\n type: c.type,\n }));\n\n return {\n id: processorEntry.id,\n name: processorEntry.name || processorEntry.id,\n description: processorEntry.description,\n phases,\n configurations,\n isWorkflow,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor');\n }\n },\n});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n method: 'POST',\n path: '/processors/:processorId/execute',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n bodySchema: executeProcessorBodySchema,\n responseSchema: executeProcessorResponseSchema,\n summary: 'Execute processor',\n description: 'Executes a specific processor with the provided input data',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId, ...bodyParams }) => {\n try {\n const { phase, messages } = bodyParams;\n\n if (!processorId) {\n throw new HTTPException(400, { message: 'Processor ID is required' });\n }\n\n if (!phase) {\n throw new HTTPException(400, { message: 'Phase is required' });\n }\n\n if (!messages || !Array.isArray(messages)) {\n throw new HTTPException(400, { message: 'Messages array is required' });\n }\n\n // Get the processor from Mastra's registered processors\n let processor;\n try {\n processor = mastra.getProcessorById(processorId);\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processor = processors[processorId as keyof typeof processors];\n }\n\n if (!processor) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n const messageList = new MessageList();\n messageList.add(messages as unknown as MessageInput[], 'input');\n\n // Check if this is a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Execute workflow processor\n try {\n // Build inputData based on phase - each phase has different required fields\n const baseInputData = {\n phase: phase as 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep',\n messages: messageList.get.all.db(),\n messageList,\n retryCount: 0,\n };\n let inputData: typeof baseInputData & Record<string, unknown> = baseInputData;\n\n // Add phase-specific fields\n switch (phase) {\n case 'input':\n inputData = {\n ...inputData,\n systemMessages: [],\n };\n break;\n case 'inputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n model: '',\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n };\n break;\n case 'outputResult':\n inputData = {\n ...inputData,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n };\n break;\n case 'outputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n };\n break;\n case 'outputStream':\n inputData = {\n ...inputData,\n part: null,\n streamParts: [],\n state: {},\n };\n break;\n }\n\n const run = await processor.createRun();\n const result = await run.start({\n inputData,\n });\n\n // Check for tripwire status\n if (result.status === 'tripwire') {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: result.tripwire.reason || `Tripwire triggered in workflow ${processor.id}`,\n metadata: result.tripwire.metadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n\n // Check for execution failure\n if (result.status !== 'success') {\n throw new HTTPException(500, {\n message: `Processor workflow ${processor.id} failed with status: ${result.status}`,\n });\n }\n\n // Extract output from workflow result\n const output = result.result;\n let outputMessages = messages;\n\n if (output && typeof output === 'object') {\n if ('messages' in output && Array.isArray(output.messages)) {\n outputMessages = output.messages;\n } else if ('messageList' in output && output.messageList instanceof MessageList) {\n outputMessages = output.messageList.get.all.db();\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Re-throw HTTP exceptions\n if (error instanceof HTTPException) {\n throw error;\n }\n throw new HTTPException(500, {\n message: `Error executing processor workflow: ${error.message}`,\n });\n }\n }\n\n // Handle individual processor execution\n // Create the abort function for tripwire support\n let tripwireTriggered = false;\n let tripwireReason: string | undefined;\n let tripwireMetadata: unknown;\n\n const abort = (reason?: string, options?: { retry?: boolean; metadata?: unknown }) => {\n tripwireTriggered = true;\n tripwireReason = reason;\n tripwireMetadata = options?.metadata;\n throw new Error(`TRIPWIRE:${reason || 'Processor aborted'}`);\n };\n\n // Build the context based on phase\n const baseContext = {\n abort,\n retryCount: 0,\n messages: messageList.get.all.db(),\n messageList,\n state: {},\n };\n\n try {\n let result: any;\n\n // Execute the specific phase method on the individual processor\n switch (phase) {\n case 'input':\n if (!processor.processInput) {\n throw new HTTPException(400, { message: 'Processor does not support input phase' });\n }\n result = await processor.processInput({\n ...baseContext,\n systemMessages: [],\n });\n break;\n\n case 'inputStep':\n if (!processor.processInputStep) {\n throw new HTTPException(400, { message: 'Processor does not support inputStep phase' });\n }\n result = await processor.processInputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n // Pass empty/default values for all inputStep fields\n model: '' as any,\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n });\n break;\n\n case 'outputResult':\n if (!processor.processOutputResult) {\n throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });\n }\n result = await processor.processOutputResult({\n ...baseContext,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n });\n break;\n\n case 'outputStep':\n if (!processor.processOutputStep) {\n throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });\n }\n result = await processor.processOutputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },\n });\n break;\n\n case 'outputStream':\n // outputStream is for streaming chunks, not a simple execute\n throw new HTTPException(400, {\n message: 'outputStream phase cannot be executed directly. Use streaming instead.',\n });\n\n default:\n throw new HTTPException(400, { message: `Unknown phase: ${phase}` });\n }\n\n // Process the result\n let outputMessages = messages;\n if (result) {\n if (Array.isArray(result)) {\n outputMessages = result;\n } else if (result.get && result.get.all && typeof result.get.all.db === 'function') {\n // It's a MessageList\n outputMessages = result.get.all.db();\n } else if (result.messages) {\n outputMessages = result.messages;\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Check if it's a tripwire\n if (tripwireTriggered || error.message?.startsWith('TRIPWIRE:')) {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: tripwireReason || error.message?.replace('TRIPWIRE:', ''),\n metadata: tripwireMetadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n throw error;\n }\n } catch (error) {\n return handleError(error, 'Error executing processor');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;AA0BA,SAAS,wBAAwB,UAA6B;CAC5D,IAAI,CAAC,YAAY,CAAC,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAC/D,OAAO;CAET,MAAM,eAAe,SAAS;CAC9B,IAAI,cAAc,SAAS,OAIzB,OAHkB,aAAa,QAAQ,MACpC,QAAQ,SAAc,MAAM,SAAS,MAAM,CAAC,CAC5C,KAAK,SAAc,MAAM,QAAQ,EACrB,CAAC,CAAC,KAAK,EAAE;CAE1B,OAAO;AACT;;;;;;;AAQA,SAAS,sBAAsB,WAAkC;CAE/D,IAAI,oBAAoB,SAAS,GAG/B,OAAO;EAAC;EAAS;EAAa;EAAgB;EAAgB;CAAY;CAI5E,MAAM,SAA2B,CAAC;CAClC,IAAI,OAAO,UAAU,iBAAiB,YACpC,OAAO,KAAK,OAAO;CAErB,IAAI,OAAO,UAAU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,UAChB,iBAAiB,OAAO;IAAA;IAI5B,OAAO;KACL,SAAS;KACT;KACA,UAAU;KACV,aAAa,EACX,UAAU,eACZ;IACF;GACF,SAAS,OAAY;IAEnB,IAAI,qBAAqB,MAAM,SAAS,WAAW,WAAW,GAC5D,OAAO;KACL,SAAS;KACT;KACA,UAAU;MACR,WAAW;MACX,QAAQ,kBAAkB,MAAM,SAAS,QAAQ,aAAa,EAAE;MAChE,UAAU;KACZ;KACA;KACA,aAAa,EACX,SACF;IACF;IAEF,MAAM;GACR;EACF,SAAS,OAAO;GACd,OAAO,YAAY,OAAO,2BAA2B;EACvD;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"processors.js","names":[],"sources":["../../../src/server/handlers/processors.ts"],"sourcesContent":["import { MessageList } from '@mastra/core/agent';\nimport type { MessageInput } from '@mastra/core/agent/message-list';\nimport { isProcessorWorkflow } from '@mastra/core/processors';\nimport type { Processor, ProcessorWorkflow } from '@mastra/core/processors';\n\nimport { HTTPException } from '../http-exception';\nimport {\n listProcessorsResponseSchema,\n serializedProcessorDetailSchema,\n processorIdPathParams,\n executeProcessorBodySchema,\n executeProcessorResponseSchema,\n} from '../schemas/processors';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { handleError } from './error';\n\n// ============================================================================\n// Route Definitions\n// ============================================================================\n\ntype ProcessorPhase = 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult';\n\n/**\n * Helper to extract text from messages for outputStep testing.\n * In real usage, the `text` field contains the assistant's response text.\n */\nfunction extractTextFromMessages(messages: unknown[]): string {\n if (!messages || !Array.isArray(messages) || messages.length === 0) {\n return '';\n }\n const firstMessage = messages[0] as any;\n if (firstMessage?.content?.parts) {\n const textParts = firstMessage.content.parts\n .filter((part: any) => part?.type === 'text')\n .map((part: any) => part?.text || '');\n return textParts.join('');\n }\n return '';\n}\n\n/**\n * Helper to detect phases for a processor.\n * For individual processors, checks which methods are implemented.\n * For workflow processors, returns all phases since createStep handles each phase\n * and it's a no-op if the underlying processor doesn't implement it.\n */\nfunction detectProcessorPhases(processor: any): ProcessorPhase[] {\n // Check if it's a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Workflow processors can potentially handle all phases\n // The createStep in workflows handles each phase and it's a no-op if not implemented\n return ['input', 'inputStep', 'outputStream', 'outputResult', 'outputStep', 'toolResult'];\n }\n\n // For individual processors, detect by checking which methods exist\n const phases: ProcessorPhase[] = [];\n if (typeof processor.processInput === 'function') {\n phases.push('input');\n }\n if (typeof processor.processInputStep === 'function') {\n phases.push('inputStep');\n }\n if (typeof processor.processOutputStream === 'function') {\n phases.push('outputStream');\n }\n if (typeof processor.processOutputResult === 'function') {\n phases.push('outputResult');\n }\n if (typeof processor.processOutputStep === 'function') {\n phases.push('outputStep');\n }\n if (typeof processor.processToolResult === 'function') {\n phases.push('toolResult');\n }\n return phases;\n}\n\nexport const LIST_PROCESSORS_ROUTE = createRoute({\n method: 'GET',\n path: '/processors',\n responseType: 'json',\n responseSchema: listProcessorsResponseSchema,\n summary: 'List all processors',\n description: 'Returns a list of all available individual processors',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra }) => {\n try {\n const processors = mastra.listProcessors() || {};\n const processorConfigurations = mastra.listProcessorConfigurations();\n const result: Record<\n string,\n {\n id: string;\n name?: string;\n description?: string;\n phases: ProcessorPhase[];\n agentIds: string[];\n configurations: Array<{ agentId: string; type: 'input' | 'output' }>;\n isWorkflow: boolean;\n }\n > = {};\n\n // Iterate through all individual processors registered with Mastra\n for (const [processorKey, processorEntry] of Object.entries(processors)) {\n const processor = processorEntry as Processor | ProcessorWorkflow;\n const processorId = processor.id || processorKey;\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processor);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processor);\n\n // Get agent configurations for this processor\n const configs = processorConfigurations.get(processorId) || [];\n const agentIds = [...new Set(configs.map(c => c.agentId))];\n const configurations = configs.map(c => ({ agentId: c.agentId, type: c.type }));\n\n result[processorId] = {\n id: processorId,\n name: processor.name || processorId,\n description: processor.description,\n phases,\n agentIds,\n configurations,\n isWorkflow,\n };\n }\n\n return result;\n } catch (error) {\n return handleError(error, 'Error getting processors');\n }\n },\n});\n\nexport const GET_PROCESSOR_BY_ID_ROUTE = createRoute({\n method: 'GET',\n path: '/processors/:processorId',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n responseSchema: serializedProcessorDetailSchema,\n summary: 'Get processor by ID',\n description: 'Returns details for a specific processor including its phases and configurations',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId }) => {\n try {\n // Get the processor from Mastra's registered processors\n let processorEntry: Processor | ProcessorWorkflow | undefined;\n try {\n processorEntry = mastra.getProcessorById(processorId) as Processor | ProcessorWorkflow;\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processorEntry = processors[processorId as keyof typeof processors] as Processor | ProcessorWorkflow;\n }\n\n if (!processorEntry) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n // Check if it's a workflow processor\n const isWorkflow = isProcessorWorkflow(processorEntry);\n\n // Detect phases (handles both individual processors and workflow processors)\n const phases = detectProcessorPhases(processorEntry);\n\n // Get agent configurations for this processor\n const configs = mastra.getProcessorConfigurations(processorId);\n const agents = mastra.listAgents() || {};\n const configurations = configs.map(c => ({\n agentId: c.agentId,\n agentName: agents[c.agentId]?.name || c.agentId,\n type: c.type,\n }));\n\n return {\n id: processorEntry.id,\n name: processorEntry.name || processorEntry.id,\n description: processorEntry.description,\n phases,\n configurations,\n isWorkflow,\n };\n } catch (error) {\n return handleError(error, 'Error getting processor');\n }\n },\n});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n method: 'POST',\n path: '/processors/:processorId/execute',\n responseType: 'json',\n pathParamSchema: processorIdPathParams,\n bodySchema: executeProcessorBodySchema,\n responseSchema: executeProcessorResponseSchema,\n summary: 'Execute processor',\n description: 'Executes a specific processor with the provided input data',\n tags: ['Processors'],\n requiresAuth: true,\n handler: async ({ mastra, processorId, ...bodyParams }) => {\n try {\n const { phase, messages } = bodyParams;\n\n if (!processorId) {\n throw new HTTPException(400, { message: 'Processor ID is required' });\n }\n\n if (!phase) {\n throw new HTTPException(400, { message: 'Phase is required' });\n }\n\n if (!messages || !Array.isArray(messages)) {\n throw new HTTPException(400, { message: 'Messages array is required' });\n }\n\n // Get the processor from Mastra's registered processors\n let processor;\n try {\n processor = mastra.getProcessorById(processorId);\n } catch {\n // getProcessorById throws if not found, try by key\n const processors = mastra.listProcessors() || {};\n processor = processors[processorId as keyof typeof processors];\n }\n\n if (!processor) {\n throw new HTTPException(404, { message: 'Processor not found' });\n }\n\n const messageList = new MessageList();\n messageList.add(messages as unknown as MessageInput[], 'input');\n\n // Check if this is a workflow processor\n if (isProcessorWorkflow(processor)) {\n // Execute workflow processor\n try {\n // Build inputData based on phase - each phase has different required fields\n const baseInputData = {\n phase: phase as 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep' | 'toolResult',\n messages: messageList.get.all.db(),\n messageList,\n retryCount: 0,\n };\n let inputData: typeof baseInputData & Record<string, unknown> = baseInputData;\n\n // Add phase-specific fields\n switch (phase) {\n case 'input':\n inputData = {\n ...inputData,\n systemMessages: [],\n };\n break;\n case 'inputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n model: '',\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n };\n break;\n case 'outputResult':\n inputData = {\n ...inputData,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n };\n break;\n case 'outputStep':\n inputData = {\n ...inputData,\n stepNumber: 0,\n systemMessages: [],\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n };\n break;\n case 'outputStream':\n inputData = {\n ...inputData,\n part: null,\n streamParts: [],\n state: {},\n };\n break;\n case 'toolResult':\n inputData = {\n ...inputData,\n stepNumber: 0,\n toolName: '',\n toolCallId: '',\n args: undefined,\n toolResultValue: undefined,\n providerExecuted: false,\n systemMessages: [],\n steps: [],\n };\n break;\n }\n\n const run = await processor.createRun();\n const result = await run.start({\n inputData,\n });\n\n // Check for tripwire status\n if (result.status === 'tripwire') {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: result.tripwire.reason || `Tripwire triggered in workflow ${processor.id}`,\n metadata: result.tripwire.metadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n\n // Check for execution failure\n if (result.status !== 'success') {\n throw new HTTPException(500, {\n message: `Processor workflow ${processor.id} failed with status: ${result.status}`,\n });\n }\n\n // Extract output from workflow result\n const output = result.result;\n let outputMessages = messages;\n\n if (output && typeof output === 'object') {\n if ('messages' in output && Array.isArray(output.messages)) {\n outputMessages = output.messages;\n } else if ('messageList' in output && output.messageList instanceof MessageList) {\n outputMessages = output.messageList.get.all.db();\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Re-throw HTTP exceptions\n if (error instanceof HTTPException) {\n throw error;\n }\n throw new HTTPException(500, {\n message: `Error executing processor workflow: ${error.message}`,\n });\n }\n }\n\n // Handle individual processor execution\n // Create the abort function for tripwire support\n let tripwireTriggered = false;\n let tripwireReason: string | undefined;\n let tripwireMetadata: unknown;\n\n const abort = (reason?: string, options?: { retry?: boolean; metadata?: unknown }) => {\n tripwireTriggered = true;\n tripwireReason = reason;\n tripwireMetadata = options?.metadata;\n throw new Error(`TRIPWIRE:${reason || 'Processor aborted'}`);\n };\n\n // Build the context based on phase\n const baseContext = {\n abort,\n retryCount: 0,\n messages: messageList.get.all.db(),\n messageList,\n state: {},\n };\n\n try {\n let result: any;\n\n // Execute the specific phase method on the individual processor\n switch (phase) {\n case 'input':\n if (!processor.processInput) {\n throw new HTTPException(400, { message: 'Processor does not support input phase' });\n }\n result = await processor.processInput({\n ...baseContext,\n systemMessages: [],\n });\n break;\n\n case 'inputStep':\n if (!processor.processInputStep) {\n throw new HTTPException(400, { message: 'Processor does not support inputStep phase' });\n }\n result = await processor.processInputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n // Pass empty/default values for all inputStep fields\n model: '' as any,\n tools: {},\n toolChoice: undefined,\n activeTools: [],\n providerOptions: undefined,\n modelSettings: undefined,\n structuredOutput: undefined,\n });\n break;\n\n case 'outputResult':\n if (!processor.processOutputResult) {\n throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });\n }\n result = await processor.processOutputResult({\n ...baseContext,\n state: {},\n result: {\n text: extractTextFromMessages(messages),\n usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },\n finishReason: 'unknown',\n steps: [],\n },\n });\n break;\n\n case 'outputStep':\n if (!processor.processOutputStep) {\n throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });\n }\n result = await processor.processOutputStep({\n ...baseContext,\n systemMessages: [],\n stepNumber: 0,\n steps: [],\n finishReason: 'stop',\n toolCalls: [],\n text: extractTextFromMessages(messages),\n usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },\n });\n break;\n\n case 'outputStream':\n // outputStream is for streaming chunks, not a simple execute\n throw new HTTPException(400, {\n message: 'outputStream phase cannot be executed directly. Use streaming instead.',\n });\n\n default:\n throw new HTTPException(400, { message: `Unknown phase: ${phase}` });\n }\n\n // Process the result\n let outputMessages = messages;\n if (result) {\n if (Array.isArray(result)) {\n outputMessages = result;\n } else if (result.get && result.get.all && typeof result.get.all.db === 'function') {\n // It's a MessageList\n outputMessages = result.get.all.db();\n } else if (result.messages) {\n outputMessages = result.messages;\n }\n }\n\n return {\n success: true,\n phase,\n messages: outputMessages,\n messageList: {\n messages: outputMessages,\n },\n };\n } catch (error: any) {\n // Check if it's a tripwire\n if (tripwireTriggered || error.message?.startsWith('TRIPWIRE:')) {\n return {\n success: false,\n phase,\n tripwire: {\n triggered: true,\n reason: tripwireReason || error.message?.replace('TRIPWIRE:', ''),\n metadata: tripwireMetadata,\n },\n messages,\n messageList: {\n messages,\n },\n };\n }\n throw error;\n }\n } catch (error) {\n return handleError(error, 'Error executing processor');\n }\n },\n});\n"],"mappings":";;;;;;;;;;;AA0BA,SAAS,wBAAwB,UAA6B;CAC5D,IAAI,CAAC,YAAY,CAAC,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAC/D,OAAO;CAET,MAAM,eAAe,SAAS;CAC9B,IAAI,cAAc,SAAS,OAIzB,OAHkB,aAAa,QAAQ,MACpC,QAAQ,SAAc,MAAM,SAAS,MAAM,CAAC,CAC5C,KAAK,SAAc,MAAM,QAAQ,EACrB,CAAC,CAAC,KAAK,EAAE;CAE1B,OAAO;AACT;;;;;;;AAQA,SAAS,sBAAsB,WAAkC;CAE/D,IAAI,oBAAoB,SAAS,GAG/B,OAAO;EAAC;EAAS;EAAa;EAAgB;EAAgB;EAAc;CAAY;CAI1F,MAAM,SAA2B,CAAC;CAClC,IAAI,OAAO,UAAU,iBAAiB,YACpC,OAAO,KAAK,OAAO;CAErB,IAAI,OAAO,UAAU,qBAAqB,YACxC,OAAO,KAAK,WAAW;CAEzB,IAAI,OAAO,UAAU,wBAAwB,YAC3C,OAAO,KAAK,cAAc;CAE5B,IAAI,OAAO,UAAU,wBAAwB,YAC3C,OAAO,KAAK,cAAc;CAE5B,IAAI,OAAO,UAAU,sBAAsB,YACzC,OAAO,KAAK,YAAY;CAE1B,IAAI,OAAO,UAAU,sBAAsB,YACzC,OAAO,KAAK,YAAY;CAE1B,OAAO;AACT;AAEA,MAAa,wBAAwB,YAAY;CAC/C,QAAQ;CACR,MAAM;CACN,cAAc;CACd,gBAAgB;CAChB,SAAS;CACT,aAAa;CACb,MAAM,CAAC,YAAY;CACnB,cAAc;CACd,SAAS,OAAO,EAAE,aAAa;EAC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AAkB,MAAM,SAAS,QAAQ,aAAa,EAAE;MAChE,UAAU;KACZ;KACA;KACA,aAAa,EACX,SACF;IACF;IAEF,MAAM;GACR;EACF,SAAS,OAAO;GACd,OAAO,YAAY,OAAO,2BAA2B;EACvD;CACF;AACF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_http_exception = require("../../http-exception-CKDHupKw.cjs");
|
|
3
3
|
const require_route_builder = require("../../route-builder-CgLVYL1c.cjs");
|
|
4
|
-
const require_utils = require("../../utils-
|
|
4
|
+
const require_utils = require("../../utils-wESuBh27.cjs");
|
|
5
5
|
const require_server_handlers_error = require("./error.cjs");
|
|
6
6
|
const require_server_handlers_version_helpers = require("./version-helpers.cjs");
|
|
7
7
|
const require_prompt_block_versions = require("../../prompt-block-versions-Bl3RmkTE.cjs");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as HTTPException } from "../../http-exception-CyfxZB6W.js";
|
|
2
2
|
import { n as createRoute } from "../../route-builder-CIk5k35M.js";
|
|
3
|
-
import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-
|
|
3
|
+
import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-BUK03Frl.js";
|
|
4
4
|
import { handleError } from "./error.js";
|
|
5
5
|
import { calculateChangedFields, computeVersionDiffs, createVersionWithRetry, enforceRetentionLimit, extractConfigFromVersion } from "./version-helpers.js";
|
|
6
6
|
import { a as createPromptBlockVersionResponseSchema, c as listPromptBlockVersionsQuerySchema, d as promptBlockVersionPathParams, i as createPromptBlockVersionBodySchema, l as listPromptBlockVersionsResponseSchema, n as comparePromptBlockVersionsQuerySchema, o as deletePromptBlockVersionResponseSchema, p as restorePromptBlockVersionResponseSchema, r as comparePromptBlockVersionsResponseSchema, s as getPromptBlockVersionResponseSchema, t as activatePromptBlockVersionResponseSchema, u as promptBlockVersionIdPathParams } from "../../prompt-block-versions-CIDwXWiC.js";
|
|
@@ -23,7 +23,7 @@ export declare const LIST_SCHEDULES_ROUTE: import("../server-adapter").ServerRou
|
|
|
23
23
|
timezone?: string | undefined;
|
|
24
24
|
lastFireAt?: number | undefined;
|
|
25
25
|
lastRunId?: string | undefined;
|
|
26
|
-
signalType?: "
|
|
26
|
+
signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder" | undefined;
|
|
27
27
|
tagName?: string | undefined;
|
|
28
28
|
attributes?: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
29
29
|
ifActive?: {
|
|
@@ -93,8 +93,8 @@ export declare const LIST_SCHEDULES_ROUTE: import("../server-adapter").ServerRou
|
|
|
93
93
|
lastFireAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
94
94
|
lastRunId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
95
95
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
96
|
-
user: "user";
|
|
97
96
|
state: "state";
|
|
97
|
+
user: "user";
|
|
98
98
|
reactive: "reactive";
|
|
99
99
|
notification: "notification";
|
|
100
100
|
"user-message": "user-message";
|
|
@@ -184,7 +184,7 @@ export declare const GET_SCHEDULE_ROUTE: import("../server-adapter").ServerRoute
|
|
|
184
184
|
timezone?: string | undefined;
|
|
185
185
|
lastFireAt?: number | undefined;
|
|
186
186
|
lastRunId?: string | undefined;
|
|
187
|
-
signalType?: "
|
|
187
|
+
signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder" | undefined;
|
|
188
188
|
tagName?: string | undefined;
|
|
189
189
|
attributes?: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
190
190
|
ifActive?: {
|
|
@@ -244,8 +244,8 @@ export declare const GET_SCHEDULE_ROUTE: import("../server-adapter").ServerRoute
|
|
|
244
244
|
lastFireAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
245
245
|
lastRunId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
246
246
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
247
|
-
user: "user";
|
|
248
247
|
state: "state";
|
|
248
|
+
user: "user";
|
|
249
249
|
reactive: "reactive";
|
|
250
250
|
notification: "notification";
|
|
251
251
|
"user-message": "user-message";
|
|
@@ -325,8 +325,8 @@ export declare const CREATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
325
325
|
threadId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
326
326
|
resourceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
327
327
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
328
|
-
user: "user";
|
|
329
328
|
state: "state";
|
|
329
|
+
user: "user";
|
|
330
330
|
reactive: "reactive";
|
|
331
331
|
notification: "notification";
|
|
332
332
|
"user-message": "user-message";
|
|
@@ -381,7 +381,7 @@ export declare const CREATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
381
381
|
timezone?: string | undefined;
|
|
382
382
|
lastFireAt?: number | undefined;
|
|
383
383
|
lastRunId?: string | undefined;
|
|
384
|
-
signalType?: "
|
|
384
|
+
signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder" | undefined;
|
|
385
385
|
tagName?: string | undefined;
|
|
386
386
|
attributes?: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
387
387
|
ifActive?: {
|
|
@@ -430,8 +430,8 @@ export declare const CREATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
430
430
|
threadId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
431
431
|
resourceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
432
432
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
433
|
-
user: "user";
|
|
434
433
|
state: "state";
|
|
434
|
+
user: "user";
|
|
435
435
|
reactive: "reactive";
|
|
436
436
|
notification: "notification";
|
|
437
437
|
"user-message": "user-message";
|
|
@@ -488,8 +488,8 @@ export declare const CREATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
488
488
|
lastFireAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
489
489
|
lastRunId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
490
490
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
491
|
-
user: "user";
|
|
492
491
|
state: "state";
|
|
492
|
+
user: "user";
|
|
493
493
|
reactive: "reactive";
|
|
494
494
|
notification: "notification";
|
|
495
495
|
"user-message": "user-message";
|
|
@@ -572,8 +572,8 @@ export declare const UPDATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
572
572
|
prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
573
573
|
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
574
574
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
575
|
-
user: "user";
|
|
576
575
|
state: "state";
|
|
576
|
+
user: "user";
|
|
577
577
|
reactive: "reactive";
|
|
578
578
|
notification: "notification";
|
|
579
579
|
"user-message": "user-message";
|
|
@@ -621,7 +621,7 @@ export declare const UPDATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
621
621
|
timezone?: string | undefined;
|
|
622
622
|
lastFireAt?: number | undefined;
|
|
623
623
|
lastRunId?: string | undefined;
|
|
624
|
-
signalType?: "
|
|
624
|
+
signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder" | undefined;
|
|
625
625
|
tagName?: string | undefined;
|
|
626
626
|
attributes?: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
627
627
|
ifActive?: {
|
|
@@ -673,8 +673,8 @@ export declare const UPDATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
673
673
|
prompt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
674
674
|
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
675
675
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
676
|
-
user: "user";
|
|
677
676
|
state: "state";
|
|
677
|
+
user: "user";
|
|
678
678
|
reactive: "reactive";
|
|
679
679
|
notification: "notification";
|
|
680
680
|
"user-message": "user-message";
|
|
@@ -724,8 +724,8 @@ export declare const UPDATE_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
724
724
|
lastFireAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
725
725
|
lastRunId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
726
726
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
727
|
-
user: "user";
|
|
728
727
|
state: "state";
|
|
728
|
+
user: "user";
|
|
729
729
|
reactive: "reactive";
|
|
730
730
|
notification: "notification";
|
|
731
731
|
"user-message": "user-message";
|
|
@@ -823,7 +823,7 @@ export declare const PAUSE_SCHEDULE_ROUTE: import("../server-adapter").ServerRou
|
|
|
823
823
|
timezone?: string | undefined;
|
|
824
824
|
lastFireAt?: number | undefined;
|
|
825
825
|
lastRunId?: string | undefined;
|
|
826
|
-
signalType?: "
|
|
826
|
+
signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder" | undefined;
|
|
827
827
|
tagName?: string | undefined;
|
|
828
828
|
attributes?: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
829
829
|
ifActive?: {
|
|
@@ -883,8 +883,8 @@ export declare const PAUSE_SCHEDULE_ROUTE: import("../server-adapter").ServerRou
|
|
|
883
883
|
lastFireAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
884
884
|
lastRunId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
885
885
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
886
|
-
user: "user";
|
|
887
886
|
state: "state";
|
|
887
|
+
user: "user";
|
|
888
888
|
reactive: "reactive";
|
|
889
889
|
notification: "notification";
|
|
890
890
|
"user-message": "user-message";
|
|
@@ -973,7 +973,7 @@ export declare const RESUME_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
973
973
|
timezone?: string | undefined;
|
|
974
974
|
lastFireAt?: number | undefined;
|
|
975
975
|
lastRunId?: string | undefined;
|
|
976
|
-
signalType?: "
|
|
976
|
+
signalType?: "state" | "user" | "reactive" | "notification" | "user-message" | "system-reminder" | undefined;
|
|
977
977
|
tagName?: string | undefined;
|
|
978
978
|
attributes?: Record<string, string | number | boolean | null | undefined> | undefined;
|
|
979
979
|
ifActive?: {
|
|
@@ -1033,8 +1033,8 @@ export declare const RESUME_SCHEDULE_ROUTE: import("../server-adapter").ServerRo
|
|
|
1033
1033
|
lastFireAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
1034
1034
|
lastRunId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
1035
1035
|
signalType: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
1036
|
-
user: "user";
|
|
1037
1036
|
state: "state";
|
|
1037
|
+
user: "user";
|
|
1038
1038
|
reactive: "reactive";
|
|
1039
1039
|
notification: "notification";
|
|
1040
1040
|
"user-message": "user-message";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_http_exception = require("../../http-exception-CKDHupKw.cjs");
|
|
3
3
|
const require_route_builder = require("../../route-builder-CgLVYL1c.cjs");
|
|
4
|
-
const require_utils = require("../../utils-
|
|
4
|
+
const require_utils = require("../../utils-wESuBh27.cjs");
|
|
5
5
|
const require_server_handlers_error = require("./error.cjs");
|
|
6
6
|
const require_server_handlers_version_helpers = require("./version-helpers.cjs");
|
|
7
|
-
const require_scorer_versions = require("../../scorer-versions-
|
|
7
|
+
const require_scorer_versions = require("../../scorer-versions-DpmAJKsY.cjs");
|
|
8
8
|
//#region src/server/handlers/scorer-versions.ts
|
|
9
9
|
const SNAPSHOT_CONFIG_FIELDS = [
|
|
10
10
|
"name",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as HTTPException } from "../../http-exception-CyfxZB6W.js";
|
|
2
2
|
import { n as createRoute } from "../../route-builder-CIk5k35M.js";
|
|
3
|
-
import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-
|
|
3
|
+
import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-BUK03Frl.js";
|
|
4
4
|
import { handleError } from "./error.js";
|
|
5
5
|
import { calculateChangedFields, computeVersionDiffs, createVersionWithRetry, enforceRetentionLimit, extractConfigFromVersion } from "./version-helpers.js";
|
|
6
|
-
import { a as createScorerVersionResponseSchema, c as listScorerVersionsQuerySchema, d as scorerVersionIdPathParams, f as scorerVersionPathParams, i as createScorerVersionBodySchema, l as listScorerVersionsResponseSchema, n as compareScorerVersionsQuerySchema, o as deleteScorerVersionResponseSchema, r as compareScorerVersionsResponseSchema, s as getScorerVersionResponseSchema, t as activateScorerVersionResponseSchema, u as restoreScorerVersionResponseSchema } from "../../scorer-versions-
|
|
6
|
+
import { a as createScorerVersionResponseSchema, c as listScorerVersionsQuerySchema, d as scorerVersionIdPathParams, f as scorerVersionPathParams, i as createScorerVersionBodySchema, l as listScorerVersionsResponseSchema, n as compareScorerVersionsQuerySchema, o as deleteScorerVersionResponseSchema, r as compareScorerVersionsResponseSchema, s as getScorerVersionResponseSchema, t as activateScorerVersionResponseSchema, u as restoreScorerVersionResponseSchema } from "../../scorer-versions-BA8N488c.js";
|
|
7
7
|
//#region src/server/handlers/scorer-versions.ts
|
|
8
8
|
const SNAPSHOT_CONFIG_FIELDS = [
|
|
9
9
|
"name",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_http_exception = require("../../http-exception-CKDHupKw.cjs");
|
|
3
3
|
const require_route_builder = require("../../route-builder-CgLVYL1c.cjs");
|
|
4
|
-
const require_utils = require("../../utils-
|
|
4
|
+
const require_utils = require("../../utils-wESuBh27.cjs");
|
|
5
5
|
const require_server_handlers_error = require("./error.cjs");
|
|
6
|
-
const require_stored_agents = require("../../stored-agents-
|
|
6
|
+
const require_stored_agents = require("../../stored-agents-DKd89v5z.cjs");
|
|
7
7
|
const require_server_handlers_authorship = require("./authorship.cjs");
|
|
8
|
-
const require_editor_builder = require("../../editor-builder-
|
|
8
|
+
const require_editor_builder = require("../../editor-builder-BW4nlDcX.cjs");
|
|
9
9
|
const require_favorites = require("../../favorites-D1-AzGsK.cjs");
|
|
10
10
|
//#region src/server/handlers/stored-agent-favorites.ts
|
|
11
11
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as HTTPException } from "../../http-exception-CyfxZB6W.js";
|
|
2
2
|
import { n as createRoute } from "../../route-builder-CIk5k35M.js";
|
|
3
|
-
import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-
|
|
3
|
+
import { i as getStoredResourceScope, n as assertStoredResourceScope } from "../../utils-BUK03Frl.js";
|
|
4
4
|
import { handleError } from "./error.js";
|
|
5
|
-
import { C as storedAgentIdPathParams } from "../../stored-agents-
|
|
5
|
+
import { C as storedAgentIdPathParams } from "../../stored-agents-D8ar1Pn7.js";
|
|
6
6
|
import { assertReadAccess, getCallerAuthorId } from "./authorship.js";
|
|
7
|
-
import { a as requireBuilderFeature } from "../../editor-builder-
|
|
7
|
+
import { a as requireBuilderFeature } from "../../editor-builder-Ct2nIbum.js";
|
|
8
8
|
import { t as favoriteToggleResponseSchema } from "../../favorites-DWDyKxts.js";
|
|
9
9
|
//#region src/server/handlers/stored-agent-favorites.ts
|
|
10
10
|
/**
|
|
@@ -2,13 +2,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_http_exception = require("../../http-exception-CKDHupKw.cjs");
|
|
3
3
|
const require_common = require("../../common-spbwhiWS.cjs");
|
|
4
4
|
const require_route_builder = require("../../route-builder-CgLVYL1c.cjs");
|
|
5
|
-
const require_utils = require("../../utils-
|
|
5
|
+
const require_utils = require("../../utils-wESuBh27.cjs");
|
|
6
6
|
const require_server_handlers_error = require("./error.cjs");
|
|
7
|
-
const require_stored_agents = require("../../stored-agents-
|
|
7
|
+
const require_stored_agents = require("../../stored-agents-DKd89v5z.cjs");
|
|
8
8
|
const require_server_handlers_version_helpers = require("./version-helpers.cjs");
|
|
9
9
|
const require_server_handlers_author_enrichment = require("./author-enrichment.cjs");
|
|
10
10
|
const require_server_handlers_authorship = require("./authorship.cjs");
|
|
11
|
-
const require_editor_builder = require("../../editor-builder-
|
|
11
|
+
const require_editor_builder = require("../../editor-builder-BW4nlDcX.cjs");
|
|
12
12
|
const require_server_handlers_favorites_enrichment = require("./favorites-enrichment.cjs");
|
|
13
13
|
const require_server_handlers_validate_avatar = require("./validate-avatar.cjs");
|
|
14
14
|
//#region src/server/handlers/stored-agents.ts
|