{"version":3,"sources":["../src/reflection.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 express from 'express';\nimport fs from 'fs/promises';\nimport getPort, { makeRange } from 'get-port';\nimport type { Server } from 'http';\nimport path from 'path';\nimport * as z from 'zod';\nimport { StatusCodes, statusNameToCode, type Status } from './action.mjs';\nimport { getGenkitRuntimeConfig } from './config.mjs';\nimport { GENKIT_REFLECTION_API_SPEC_VERSION, GENKIT_VERSION } from './index.mjs';\nimport { logger } from './logging.mjs';\nimport {\n  DEFAULT_REFLECTION_PORT,\n  REFLECTION_SECRET_HEADER,\n  advertisedReflectionHost,\n  isLoopbackHost,\n  resolveReflectionConfig,\n  resolveReflectionServerConfig,\n  secretsEqual,\n  type ReflectionPort,\n  type ReflectionServerConfig,\n} from './reflection-config.mjs';\nimport type { Registry } from './registry.mjs';\nimport { toJsonSchema } from './schema.mjs';\nimport { flushTracing, setTelemetryServerUrl } from './tracing.mjs';\nimport { isDevEnv } from './utils.mjs';\n\n/** Bind attempts for a probed (unchosen) port before giving up. */\nconst PROBE_BIND_ATTEMPTS = 5;\n\nfunction listenOnce(\n  app: express.Express,\n  port: number,\n  host: string\n): Promise<Server> {\n  return new Promise<Server>((resolve, reject) => {\n    const s = app.listen(port, host, () => {\n      s.removeListener('error', reject);\n      resolve(s);\n    });\n    s.once('error', reject);\n  });\n}\n\nfunction isAddressInUse(e: unknown): boolean {\n  return e instanceof Error && 'code' in e && e.code === 'EADDRINUSE';\n}\n\n// TODO: Move this to common location for schemas.\nexport const RunActionResponseSchema = z.object({\n  result: z.unknown().optional(),\n  error: z.unknown().optional(),\n  telemetry: z\n    .object({\n      traceId: z.string().optional(),\n    })\n    .optional(),\n});\nexport type RunActionResponse = z.infer<typeof RunActionResponseSchema>;\n\nexport interface ReflectionServerOptions {\n  /**\n   * Exact port to bind; fails if it is taken. `0` lets the OS pick. When\n   * unset, probes upward from 3100. `GENKIT_REFLECTION_PORT` overrides this.\n   */\n  port?: number;\n  /** Body size limit for the server. Defaults to `30mb`. */\n  bodyLimit?: string;\n  /** Configured environments. Defaults to `dev`. */\n  configuredEnvs?: string[];\n  /** Display name that will be shown in developer tooling. */\n  name?: string;\n}\n\n/**\n * Checks if an error is an AbortError (from AbortController.abort()).\n */\nfunction isAbortError(err: any): boolean {\n  return (\n    err?.name === 'AbortError' ||\n    (typeof DOMException !== 'undefined' &&\n      err instanceof DOMException &&\n      err.name === 'AbortError')\n  );\n}\n\n/**\n * Reflection server exposes an API for inspecting and interacting with Genkit in development.\n *\n * This is for use in development environments.\n *\n * @hidden\n */\nexport class ReflectionServer {\n  /** List of all running servers needed to be cleaned up on process exit. */\n  private static RUNNING_SERVERS: ReflectionServer[] = [];\n\n  /** Registry instance to be used for API calls. */\n  private registry: Registry;\n  /** Options for the reflection server. */\n  private options: ReflectionServerOptions;\n  /** Port the server is actually running on. This may differ from `options.port` if the original was occupied. Null if server is not running. */\n  private port: number | null = null;\n  /** Express server instance. Null if server is not running. */\n  private server: Server | null = null;\n  /** Path to the runtime file. Null if server is not running. */\n  private runtimeFilePath: string | null = null;\n  /** Map of active actions indexed by trace ID for cancellation support. */\n  private activeActions = new Map<\n    string,\n    {\n      abortController: AbortController;\n      startTime: Date;\n    }\n  >();\n  private v2Server: any | null = null;\n\n  constructor(registry: Registry, options?: ReflectionServerOptions) {\n    this.registry = registry;\n    this.options = {\n      bodyLimit: '30mb',\n      configuredEnvs: ['dev'],\n      ...options,\n    };\n  }\n\n  get runtimeId() {\n    return `${process.pid}${this.port !== null ? `-${this.port}` : ''}`;\n  }\n\n  /**\n   * Finds a free port, probing upward from `startPort`. Used only when no\n   * port was chosen; a chosen port is bound exactly.\n   */\n  async findPort(startPort: number = DEFAULT_REFLECTION_PORT): Promise<number> {\n    const chosenPort = startPort;\n    const freePort = await getPort({\n      // Clamped: makeRange rejects anything above 65536, which a caller\n      // starting from a high ephemeral port would otherwise hit.\n      port: makeRange(chosenPort, Math.min(chosenPort + 100, 65535)),\n    });\n    if (freePort !== chosenPort) {\n      logger.warn(\n        `Port ${chosenPort} is already in use, using next available port ${freePort} instead.`\n      );\n    }\n    return freePort;\n  }\n\n  /**\n   * Binds `app` and sets `this.port`.\n   *\n   * A chosen port (env or code) is bound exactly or fails: shifting to the\n   * next free one would leave whoever chose it talking to a dead port.\n   *\n   * A probed port is retried on EADDRINUSE: findPort() checks a port and\n   * releases it before listen() binds, so another process starting at the\n   * same time (e.g. two runtimes in a monorepo) can take it in between.\n   */\n  private async listen(\n    app: express.Express,\n    host: string,\n    port: ReflectionPort\n  ): Promise<Server> {\n    if (port.kind === 'pinned') {\n      this.port = port.port;\n      return listenOnce(app, port.port, host);\n    }\n    for (let attempt = 1; ; attempt++) {\n      this.port = await this.findPort();\n      try {\n        return await listenOnce(app, this.port, host);\n      } catch (e) {\n        if (!isAddressInUse(e) || attempt >= PROBE_BIND_ATTEMPTS) {\n          throw e;\n        }\n        logger.debug(\n          `Port ${this.port} was taken before it could be bound, probing again.`\n        );\n      }\n    }\n  }\n\n  /**\n   * Rejects a request that does not carry the configured secret.\n   *\n   * `/api/__health` is exempt: it carries no registry content and is what\n   * orchestrators and the CLI probe before they have any reason to know a\n   * secret. The 401 body is empty on purpose.\n   */\n  private authMiddleware(secret: string): express.RequestHandler {\n    return (req, res, next) => {\n      if (req.path === '/api/__health') {\n        next();\n        return;\n      }\n      const provided = req.header(REFLECTION_SECRET_HEADER);\n      if (!provided || !secretsEqual(provided, secret)) {\n        res.status(401).end();\n        return;\n      }\n      next();\n    };\n  }\n\n  /**\n   * Starts the server.\n   *\n   * The server will be registered to be shut down on process exit.\n   */\n  async start() {\n    if (getGenkitRuntimeConfig().sandboxedRuntime) {\n      logger.debug(\n        'Skipping ReflectionServer start: not supported in sandboxed runtime.'\n      );\n      return;\n    }\n    const resolved = resolveReflectionConfig(process.env, {\n      port: this.options.port,\n    });\n    if (resolved.kind === 'disabled') {\n      logger.debug('Reflection API disabled by GENKIT_REFLECTION_ENABLED.');\n      return;\n    }\n    // Reaching start() is itself a request for a server, so `off` (nothing in\n    // the environment turned it on) still starts one, with the environment's\n    // host/port/v2 settings. Genkit's own constructor checks the config first\n    // and does not call start() at all.\n    const config: ReflectionServerConfig =\n      resolved.kind === 'off'\n        ? resolveReflectionServerConfig(process.env, {\n            port: this.options.port,\n          })\n        : resolved;\n    if (config.kind === 'v2') {\n      const { ReflectionServerV2 } = await import('./reflection-v2.mjs');\n      this.v2Server = new ReflectionServerV2(this.registry, {\n        configuredEnvs: this.options.configuredEnvs,\n        name: this.options.name,\n        url: config.url,\n        secret: config.secret,\n      });\n      await this.v2Server.start();\n      ReflectionServer.RUNNING_SERVERS.push(this);\n      return;\n    }\n\n    const server = express();\n\n    server.use(express.json({ limit: this.options.bodyLimit }));\n    server.use((req, res, next) => {\n      res.header('x-genkit-version', GENKIT_VERSION);\n      next();\n    });\n    if (config.secret) {\n      server.use(this.authMiddleware(config.secret));\n    } else if (!isLoopbackHost(config.host)) {\n      logger.warn(\n        `Reflection API is listening on ${config.host} without authentication. ` +\n          'Anyone who can reach this port can run any registered action. Set ' +\n          'GENKIT_REFLECTION_SECRET_TOKEN, or front it with your own auth.'\n      );\n    }\n\n    server.get('/api/__health', async (req, response) => {\n      if (req.query['id'] && req.query['id'] !== this.runtimeId) {\n        response.status(503).send('Invalid runtime ID');\n        return;\n      }\n      await this.registry.listActions();\n      response.status(200).send('OK');\n    });\n\n    // Dev only: it kills the server and answers GET, so any page that can\n    // cause a request to it could take the process down.\n    if (isDevEnv()) {\n      server.get('/api/__quitquitquit', async (_, response) => {\n        logger.debug('Received quitquitquit');\n        response.status(200).send('OK');\n        await this.stop();\n      });\n    }\n\n    server.get('/api/values', async (req, response, next) => {\n      logger.debug('Fetching values.');\n      try {\n        const type = req.query.type;\n        if (!type) {\n          response.status(400).send('Query parameter \"type\" is required.');\n          return;\n        }\n        if (type !== 'defaultModel' && type !== 'middleware') {\n          response\n            .status(400)\n            .send(\n              `'type' ${type} is not supported. Only 'defaultModel' and 'middleware' are supported`\n            );\n          return;\n        }\n        const values = await this.registry.listValues(type as string);\n        const mappedValues: Record<string, any> = {};\n        for (const [key, value] of Object.entries(values)) {\n          mappedValues[key] =\n            value &&\n            (value as any).toJson &&\n            typeof (value as any).toJson === 'function'\n              ? (value as any).toJson()\n              : value;\n        }\n        response.send(mappedValues);\n      } catch (err) {\n        const { message, stack } = err as Error;\n        next({ message, stack });\n      }\n    });\n\n    server.get('/api/actions', async (_, response, next) => {\n      logger.debug('Fetching actions.');\n      try {\n        const actions = await this.registry.listResolvableActions();\n        const convertedActions = {};\n        Object.keys(actions).forEach((key) => {\n          const action = actions[key];\n          convertedActions[key] = {\n            key,\n            name: action.name,\n            description: action.description,\n            metadata: action.metadata,\n          };\n          if (action.inputSchema || action.inputJsonSchema) {\n            convertedActions[key].inputSchema = toJsonSchema({\n              schema: action.inputSchema,\n              jsonSchema: action.inputJsonSchema,\n            });\n          }\n          if (action.outputSchema || action.outputJsonSchema) {\n            convertedActions[key].outputSchema = toJsonSchema({\n              schema: action.outputSchema,\n              jsonSchema: action.outputJsonSchema,\n            });\n          }\n        });\n        response.send(convertedActions);\n      } catch (err) {\n        const { message, stack } = err as Error;\n        next({ message, stack });\n      }\n    });\n\n    server.post('/api/runAction', async (request, response, next) => {\n      const { key, input, init, context, telemetryLabels } = request.body;\n      const { stream } = request.query;\n      logger.debug(`Running action \\`${key}\\` with stream=${stream}...`);\n      const abortController = new AbortController();\n      let traceId: string | undefined;\n      try {\n        const action = await this.registry.lookupAction(key);\n        if (!action) {\n          response.status(404).send(`action ${key} not found`);\n          return;\n        }\n        // Set up onTraceStart callback to send trace ID in headers early.\n        // This fires once for the root action span, before any streaming chunks\n        // or final result are returned.\n        const onTraceStartCallback = ({\n          traceId: tid,\n          spanId,\n        }: {\n          traceId: string;\n          spanId: string;\n        }) => {\n          traceId = tid; // Update traceId for cleanup later\n          this.activeActions.set(tid, {\n            abortController,\n            startTime: new Date(),\n          });\n          response.setHeader('X-Genkit-Trace-Id', tid);\n          response.setHeader('X-Genkit-Span-Id', spanId);\n          response.setHeader('X-Genkit-Version', GENKIT_VERSION);\n          if (stream === 'true') {\n            response.setHeader('Content-Type', 'text/plain');\n            response.setHeader('Transfer-Encoding', 'chunked');\n          } else {\n            response.setHeader('Content-Type', 'application/json');\n            // Force chunked encoding so we can flush headers early\n            response.setHeader('Transfer-Encoding', 'chunked');\n          }\n          response.statusCode = 200;\n          response.flushHeaders();\n        };\n        if (stream === 'true') {\n          try {\n            const callback = (chunk) => {\n              response.write(JSON.stringify(chunk) + '\\n');\n            };\n            const result = await action.run(input, {\n              context: context || {},\n              init,\n              onChunk: callback,\n              telemetryLabels,\n              onTraceStart: onTraceStartCallback,\n              abortSignal: abortController.signal,\n            });\n            await flushTracing();\n            response.write(\n              JSON.stringify({\n                result: result.result,\n                telemetry: {\n                  traceId: result.telemetry.traceId,\n                },\n              } as RunActionResponse)\n            );\n            response.end();\n          } catch (err) {\n            const { message, stack } = err as Error;\n            const isAbort = isAbortError(err);\n            const code: StatusCodes = isAbort\n              ? StatusCodes.CANCELLED\n              : (statusNameToCode((err as any)?.status) ??\n                StatusCodes.INTERNAL);\n            // since we're streaming, we must do special error handling here -- the headers are already sent.\n            const errorResponse: Status = {\n              code,\n              message: isAbort ? 'Action was cancelled' : message,\n              details: {\n                stack,\n              },\n            };\n            if ((err as any).traceId) {\n              errorResponse.details.traceId = (err as any).traceId;\n            }\n            response.write(\n              JSON.stringify({\n                error: errorResponse,\n              } as RunActionResponse)\n            );\n            response.end();\n          }\n        } else {\n          // Non-streaming: send JSON response\n          const result = await action.run(input, {\n            context: context || {},\n            init,\n            telemetryLabels,\n            onTraceStart: onTraceStartCallback,\n            abortSignal: abortController.signal,\n          });\n          await flushTracing();\n          response.end(\n            JSON.stringify({\n              result: result.result,\n              telemetry: {\n                traceId: result.telemetry.traceId,\n              },\n            } as RunActionResponse)\n          );\n        }\n      } catch (err) {\n        const { message, stack } = err as Error;\n        const isAbort = isAbortError(err);\n        const code: StatusCodes = isAbort\n          ? StatusCodes.CANCELLED\n          : (statusNameToCode((err as any)?.status) ?? StatusCodes.INTERNAL);\n        const errorResponse: Status = {\n          code,\n          message: isAbort ? 'Action was cancelled' : message,\n          details: { stack, traceId: (err as any).traceId || traceId },\n        };\n        if (response.headersSent) {\n          // Headers already sent via onTraceStart, must send error in response body\n          response.end(\n            JSON.stringify({ error: errorResponse } as RunActionResponse)\n          );\n        } else {\n          // Headers not sent yet, use standard error handling\n          next({ message, stack });\n        }\n      } finally {\n        if (traceId) {\n          this.activeActions.delete(traceId);\n        }\n      }\n    });\n\n    server.post('/api/cancelAction', async (request, response) => {\n      const { traceId } = request.body;\n\n      if (!traceId || typeof traceId !== 'string') {\n        response.status(400).json({ error: 'traceId is required' });\n        return;\n      }\n\n      const activeAction = this.activeActions.get(traceId);\n\n      if (activeAction) {\n        activeAction.abortController.abort();\n        this.activeActions.delete(traceId);\n        response.status(200).json({ message: 'Action cancelled' });\n      } else {\n        response.status(404).json({\n          message: 'Action not found or already completed',\n        });\n      }\n    });\n\n    server.get('/api/envs', async (_, response) => {\n      response.json(this.options.configuredEnvs);\n    });\n\n    server.post('/api/notify', async (request, response) => {\n      const { telemetryServerUrl, reflectionApiSpecVersion } = request.body;\n      if (!process.env.GENKIT_TELEMETRY_SERVER) {\n        if (typeof telemetryServerUrl === 'string') {\n          setTelemetryServerUrl(telemetryServerUrl);\n          logger.debug(\n            `Connected to telemetry server on ${telemetryServerUrl}`\n          );\n        }\n      }\n      if (reflectionApiSpecVersion !== GENKIT_REFLECTION_API_SPEC_VERSION) {\n        if (\n          !reflectionApiSpecVersion ||\n          reflectionApiSpecVersion < GENKIT_REFLECTION_API_SPEC_VERSION\n        ) {\n          logger.warn(\n            'WARNING: Genkit CLI version may be outdated. Please update `genkit-cli` to the latest version.'\n          );\n        } else {\n          logger.warn(\n            'Genkit CLI is newer than runtime library. Some feature may not be supported. ' +\n              'Consider upgrading your runtime library version (debug info: expected ' +\n              `${GENKIT_REFLECTION_API_SPEC_VERSION}, got ${reflectionApiSpecVersion}).`\n          );\n        }\n      }\n      response.status(200).send('OK');\n    });\n\n    server.use((err, req, res, next) => {\n      logger.error(err.stack);\n      const error = err as Error;\n      const { message, stack } = error;\n      const errorResponse: Status = {\n        code: StatusCodes.INTERNAL,\n        message,\n        details: {\n          stack,\n        },\n      };\n\n      // Headers may have been sent already (via onTraceStart), so check before setting status\n      res.status(200).end(JSON.stringify({ error: errorResponse }));\n    });\n\n    const listening = await this.listen(server, config.host, config.port);\n    // Assigned only once listening, so stop() after a failed bind is a no-op\n    // instead of closing a server that never started.\n    this.server = listening;\n    // With port 0 the OS picked the port; record the real one so the runtime\n    // file and logs point at something reachable.\n    const address = listening.address();\n    if (address && typeof address === 'object') {\n      this.port = address.port;\n    }\n\n    logger.debug(\n      `Reflection server (${process.pid}) running on http://${config.host}:${this.port}`\n    );\n    ReflectionServer.RUNNING_SERVERS.push(this);\n\n    try {\n      await this.registry.listActions();\n      // Dev only: the file exists so a local CLI watching the same filesystem\n      // can discover this runtime. Nothing is watching in a container, and the\n      // working directory is frequently read-only.\n      if (isDevEnv()) {\n        await this.writeRuntimeFile(config.host, config.secret);\n      }\n    } catch (e) {\n      logger.error(`Error initializing plugins: ${e}`);\n      try {\n        await this.stop();\n      } catch (err) {\n        logger.error(`Failed to stop server gracefully: ${err}`);\n      }\n    }\n  }\n\n  /**\n   * Stops the server and removes it from the list of running servers to clean up on exit.\n   */\n  async stop(): Promise<void> {\n    // Claim the server before the first await: stop() can race with itself\n    // (e.g. /api/__quitquitquit arriving alongside a SIGTERM), and a second\n    // caller must see nothing left to stop rather than close it twice.\n    const v2Server = this.v2Server;\n    this.v2Server = null;\n    if (v2Server) {\n      await v2Server.stop();\n      this.removeFromRunningServers();\n      return;\n    }\n\n    const server = this.server;\n    this.server = null;\n    if (!server) {\n      return;\n    }\n    await this.cleanupRuntimeFile();\n    await new Promise<void>((resolve, reject) => {\n      server.close((err) => {\n        if (err) {\n          logger.error(\n            `Error shutting down reflection server on port ${this.port}: ${err}`\n          );\n          reject(err);\n          return;\n        }\n        resolve();\n      });\n    });\n    this.removeFromRunningServers();\n    logger.debug(\n      `Reflection server on port ${this.port} has successfully shut down.`\n    );\n    this.port = null;\n  }\n\n  private removeFromRunningServers() {\n    const index = ReflectionServer.RUNNING_SERVERS.indexOf(this);\n    if (index > -1) {\n      ReflectionServer.RUNNING_SERVERS.splice(index, 1);\n    }\n  }\n\n  /**\n   * Writes the runtime file to the project root.\n   */\n  private async writeRuntimeFile(host: string, secret?: string) {\n    try {\n      const rootDir = await findProjectRoot();\n      const runtimesDir = path.join(rootDir, '.genkit', 'runtimes');\n      const date = new Date();\n      const time = date.getTime();\n      const timestamp = date.toISOString();\n      this.runtimeFilePath = path.join(\n        runtimesDir,\n        `${this.runtimeId}-${time}.json`\n      );\n      const fileContent = JSON.stringify(\n        {\n          id: process.env.GENKIT_RUNTIME_ID || this.runtimeId,\n          pid: process.pid,\n          name: this.options.name,\n          reflectionServerUrl: `http://${advertisedReflectionHost(host)}:${this.port}`,\n          timestamp,\n          genkitVersion: `nodejs/${GENKIT_VERSION}`,\n          reflectionApiSpecVersion: GENKIT_REFLECTION_API_SPEC_VERSION,\n          // Advertised so any local CLI process can reach this runtime, not\n          // just the one that spawned it. Dev only, and mode 0600.\n          reflectionSecret: secret,\n        },\n        null,\n        2\n      );\n      await fs.mkdir(runtimesDir, { recursive: true });\n      await fs.writeFile(this.runtimeFilePath, fileContent, {\n        encoding: 'utf8',\n        mode: 0o600,\n      });\n      logger.debug(`Runtime file written: ${this.runtimeFilePath}`);\n    } catch (error) {\n      logger.error(`Error writing runtime file: ${error}`);\n    }\n  }\n\n  /**\n   * Cleans up the port file.\n   */\n  private async cleanupRuntimeFile() {\n    if (!this.runtimeFilePath) {\n      return;\n    }\n    try {\n      const fileContent = await fs.readFile(this.runtimeFilePath, 'utf8');\n      const data = JSON.parse(fileContent);\n      if (data.pid === process.pid) {\n        await fs.unlink(this.runtimeFilePath);\n        logger.debug(`Runtime file cleaned up: ${this.runtimeFilePath}`);\n      }\n    } catch (error) {\n      logger.error(`Error cleaning up runtime file: ${error}`);\n    }\n  }\n\n  /**\n   * Stops all running reflection servers.\n   */\n  static async stopAll() {\n    return Promise.all(\n      ReflectionServer.RUNNING_SERVERS.map((server) => server.stop())\n    );\n  }\n}\n\n/**\n * Finds the project root by looking for a `package.json` file.\n */\nasync function findProjectRoot(): Promise<string> {\n  let currentDir = process.cwd();\n  while (currentDir !== path.parse(currentDir).root) {\n    const packageJsonPath = path.join(currentDir, 'package.json');\n    try {\n      await fs.access(packageJsonPath);\n      return currentDir;\n    } catch {\n      currentDir = path.dirname(currentDir);\n    }\n  }\n  throw new Error('Could not find project root (package.json not found)');\n}\n\n// TODO: Verify that this works.\nif (typeof module !== 'undefined' && 'hot' in module) {\n  (module as any).hot.accept();\n  (module as any).hot.dispose(async () => {\n    logger.debug('Cleaning up reflection server(s) before module reload...');\n    await ReflectionServer.stopAll();\n  });\n}\n"],"mappings":"AAgBA,OAAO,aAAa;AACpB,OAAO,QAAQ;AACf,OAAO,WAAW,iBAAiB;AAEnC,OAAO,UAAU;AACjB,YAAY,OAAO;AACnB,SAAS,aAAa,wBAAqC;AAC3D,SAAS,8BAA8B;AACvC,SAAS,oCAAoC,sBAAsB;AACnE,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAEP,SAAS,oBAAoB;AAC7B,SAAS,cAAc,6BAA6B;AACpD,SAAS,gBAAgB;AAG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