@genkit-ai/core
Version:
Genkit AI framework core libraries.
1 lines • 6.34 kB
Source Map (JSON)
{"version":3,"sources":["../src/reflection-types.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { z } from 'zod';\nimport { ActionMetadataSchema } from './action.mjs';\n\n// NOTE: Keep this file in sync with genkit-tools/common/src/types/reflection.ts\n// and genkit-tools/common/src/types/apis.ts.\n\n/**\n * ReflectionRegisterSchema is the payload for the 'register' method.\n */\nexport const ReflectionRegisterParamsSchema = z.object({\n id: z.string(),\n pid: z.number(),\n name: z.string().optional(),\n genkitVersion: z.string().optional(),\n reflectionApiSpecVersion: z.number().optional(),\n envs: z.array(z.string()).optional(),\n});\n\nexport type ReflectionRegisterParams = z.infer<\n typeof ReflectionRegisterParamsSchema\n>;\n\n/**\n * ReflectionStreamChunkSchema is the payload for the 'streamChunk' method.\n */\nexport const ReflectionStreamChunkParamsSchema = z.object({\n requestId: z.string(),\n chunk: z.any(),\n});\n\nexport type ReflectionStreamChunkParams = z.infer<\n typeof ReflectionStreamChunkParamsSchema\n>;\n\n/**\n * ReflectionRunActionStateSchema is the payload for the 'runActionState' method.\n */\nexport const ReflectionRunActionStateParamsSchema = z.object({\n requestId: z.string(),\n state: z\n .object({\n traceId: z.string().optional(),\n })\n .optional(),\n});\n\nexport type ReflectionRunActionStateParams = z.infer<\n typeof ReflectionRunActionStateParamsSchema\n>;\n\n/**\n * ReflectionConfigureSchema is the payload for the 'configure' method.\n */\nexport const ReflectionConfigureParamsSchema = z.object({\n telemetryServerUrl: z.string().optional(),\n});\n\nexport type ReflectionConfigureParams = z.infer<\n typeof ReflectionConfigureParamsSchema\n>;\n\n/**\n * ReflectionListValuesSchema is the payload for the 'listValues' method.\n */\nexport const ReflectionListValuesParamsSchema = z.object({\n type: z.string(),\n});\n\nexport type ReflectionListValuesParams = z.infer<\n typeof ReflectionListValuesParamsSchema\n>;\n\n/**\n * ReflectionRunActionSchema is the payload for the 'runAction' method.\n */\nexport const ReflectionRunActionParamsSchema = z.object({\n key: z.string(),\n input: z.any().optional(),\n context: z.any().optional(),\n telemetryLabels: z.record(z.string(), z.string()).optional(),\n stream: z.boolean().optional(),\n streamInput: z.boolean().optional(),\n});\n\nexport type ReflectionRunActionParams = z.infer<\n typeof ReflectionRunActionParamsSchema\n>;\n\n/**\n * ReflectionCancelActionSchema is the payload for the 'cancelAction' method.\n */\nexport const ReflectionCancelActionParamsSchema = z.object({\n traceId: z.string(),\n});\n\nexport type ReflectionCancelActionParams = z.infer<\n typeof ReflectionCancelActionParamsSchema\n>;\n\n/**\n * ReflectionSendInputStreamChunkSchema is the payload for the 'sendInputStreamChunk' method.\n */\nexport const ReflectionSendInputStreamChunkParamsSchema = z.object({\n requestId: z.string(),\n chunk: z.any(),\n});\n\nexport type ReflectionSendInputStreamChunkParams = z.infer<\n typeof ReflectionSendInputStreamChunkParamsSchema\n>;\n\n/**\n * ReflectionEndInputStreamSchema is the payload for the 'endInputStream' method.\n */\nexport const ReflectionEndInputStreamParamsSchema = z.object({\n requestId: z.string(),\n});\n\nexport type ReflectionEndInputStreamParams = z.infer<\n typeof ReflectionEndInputStreamParamsSchema\n>;\n\n/**\n * ReflectionListActionsResponseSchema is the result for the 'listActions' method.\n */\nexport const ReflectionListActionsResponseSchema = z.object({\n actions: z.record(z.string(), ActionMetadataSchema),\n});\n\nexport type ReflectionListActionsResponse = z.infer<\n typeof ReflectionListActionsResponseSchema\n>;\n\n/**\n * ReflectionListValuesResponseSchema is the result for the 'listValues' method.\n */\nexport const ReflectionListValuesResponseSchema = z.object({\n values: z.record(z.any()),\n});\n\nexport type ReflectionListValuesResponse = z.infer<\n typeof ReflectionListValuesResponseSchema\n>;\n\n/**\n * ReflectionCancelActionResponseSchema is the result for the 'cancelAction' method.\n */\nexport const ReflectionCancelActionResponseSchema = z.object({\n message: z.string(),\n});\n\nexport type ReflectionCancelActionResponse = z.infer<\n typeof ReflectionCancelActionResponseSchema\n>;\n"],"mappings":"AAgBA,SAAS,SAAS;AAClB,SAAS,4BAA4B;AAQ9B,MAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,IAAI,EAAE,OAAO;AAAA,EACb,KAAK,EAAE,OAAO;AAAA,EACd,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA,EACnC,0BAA0B,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9C,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AACrC,CAAC;AASM,MAAM,oCAAoC,EAAE,OAAO;AAAA,EACxD,WAAW,EAAE,OAAO;AAAA,EACpB,OAAO,EAAE,IAAI;AACf,CAAC;AASM,MAAM,uCAAuC,EAAE,OAAO;AAAA,EAC3D,WAAW,EAAE,OAAO;AAAA,EACpB,OAAO,EACJ,OAAO;AAAA,IACN,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,CAAC,EACA,SAAS;AACd,CAAC;AASM,MAAM,kCAAkC,EAAE,OAAO;AAAA,EACtD,oBAAoB,EAAE,OAAO,EAAE,SAAS;AAC1C,CAAC;AASM,MAAM,mCAAmC,EAAE,OAAO;AAAA,EACvD,MAAM,EAAE,OAAO;AACjB,CAAC;AASM,MAAM,kCAAkC,EAAE,OAAO;AAAA,EACtD,KAAK,EAAE,OAAO;AAAA,EACd,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACxB,SAAS,EAAE,IAAI,EAAE,SAAS;AAAA,EAC1B,iBAAiB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAAE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