@shell-shock/core 0.16.1 → 0.17.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.
Files changed (41) hide show
  1. package/dist/components/{spawn-builtin.cjs → exec-builtin.cjs} +122 -56
  2. package/dist/components/exec-builtin.cjs.map +1 -0
  3. package/dist/components/exec-builtin.d.cts +12 -0
  4. package/dist/components/exec-builtin.d.cts.map +1 -0
  5. package/dist/components/exec-builtin.d.mts +12 -0
  6. package/dist/components/exec-builtin.d.mts.map +1 -0
  7. package/dist/components/{spawn-builtin.mjs → exec-builtin.mjs} +122 -56
  8. package/dist/components/exec-builtin.mjs.map +1 -0
  9. package/dist/components/index.cjs +3 -2
  10. package/dist/components/index.d.cts +3 -3
  11. package/dist/components/index.d.mts +3 -3
  12. package/dist/components/index.mjs +3 -3
  13. package/dist/components/state-builtin.cjs +11 -5
  14. package/dist/components/state-builtin.cjs.map +1 -1
  15. package/dist/components/state-builtin.mjs +11 -5
  16. package/dist/components/state-builtin.mjs.map +1 -1
  17. package/dist/components/utils-builtin.cjs +147 -0
  18. package/dist/components/utils-builtin.cjs.map +1 -1
  19. package/dist/components/utils-builtin.d.cts +5 -1
  20. package/dist/components/utils-builtin.d.cts.map +1 -1
  21. package/dist/components/utils-builtin.d.mts +5 -1
  22. package/dist/components/utils-builtin.d.mts.map +1 -1
  23. package/dist/components/utils-builtin.mjs +148 -2
  24. package/dist/components/utils-builtin.mjs.map +1 -1
  25. package/dist/plugin.cjs +2 -2
  26. package/dist/plugin.cjs.map +1 -1
  27. package/dist/plugin.mjs +2 -2
  28. package/dist/plugin.mjs.map +1 -1
  29. package/dist/types/env.cjs +1 -1
  30. package/dist/types/env.cjs.map +1 -1
  31. package/dist/types/env.d.cts +1 -1
  32. package/dist/types/env.d.mts +1 -1
  33. package/dist/types/env.mjs +1 -1
  34. package/dist/types/env.mjs.map +1 -1
  35. package/package.json +16 -16
  36. package/dist/components/spawn-builtin.cjs.map +0 -1
  37. package/dist/components/spawn-builtin.d.cts +0 -12
  38. package/dist/components/spawn-builtin.d.cts.map +0 -1
  39. package/dist/components/spawn-builtin.d.mts +0 -12
  40. package/dist/components/spawn-builtin.d.mts.map +0 -1
  41. package/dist/components/spawn-builtin.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawn-builtin.mjs","names":[],"sources":["../../src/components/spawn-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\n\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface SpawnBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling child process spawning in Shell Shock.\n */\nexport function SpawnBuiltin(props: SpawnBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"spawn\"\n description=\"A module to handle spawning child processes.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:path\": [\"basename\", \"extname\", \"dirname\", \"join\"],\n \"node:fs\": [\"existsSync\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:stream\": [{ name: \"Stream\", default: true, type: true }]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isWindows\"]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; baseEnv?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const baseEnv = params.baseEnv ?? process.env;\nconst argv = params.argv;\nconst shouldSuppressNpmFund = (() => {\n const cmd = basename(argv[0] ?? \"\");\n if (cmd === \"npm\" || cmd === \"npm.cmd\" || cmd === \"npm.exe\") {\n return true;\n }\n if (cmd === \"node\" || cmd === \"node.exe\") {\n const script = argv[1] ?? \"\";\n\n return script.includes(\"npm-cli.js\");\n }\n return false;\n})();\n\nconst mergedEnv = params.env ? { ...baseEnv, ...params.env } : { ...baseEnv };\nconst resolvedEnv = Object.fromEntries(\n Object.entries(mergedEnv)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n);\nif (shouldSuppressNpmFund) {\n resolvedEnv.NPM_CONFIG_FUND ??= \"false\";\n resolvedEnv.npm_config_fund ??= \"false\";\n}\nreturn resolvedEnv;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isWindowsBatchCommand\"\n parameters={[{ name: \"resolvedCommand\", type: \"string\" }]}\n returnType=\"boolean\">\n {code`if (!isWindows) {\n return false;\n}\nconst ext = extname(resolvedCommand).toLowerCase();\n\nreturn ext === \".cmd\" || ext === \".bat\";`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"escapeForCmdExe\"\n parameters={[{ name: \"arg\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (/[&|<>^%\\\\\\\\r\\\\\\\\n]/.test(arg)) {\n throw new Error(\n \\`Unsafe Windows cmd.exe argument detected: \\${JSON.stringify(arg)}. \\` +\n \"Pass an explicit shell-wrapper argv at the call site instead.\"\n );\n}\nif (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n}\nreturn \\`\"\\${arg.replace(/\"/g, '\"\"')}\"\\`;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"buildCmdExeCommandLine\"\n parameters={[\n { name: \"resolvedCommand\", type: \"string\" },\n { name: \"args\", type: \"string[]\" }\n ]}\n returnType=\"string\">\n {code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(\n \" \"\n);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveNpmArgvForWindows\"\n doc=\"On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.\"\n parameters={[{ name: \"argv\", type: \"string[]\" }]}\n returnType=\"string[] | null\">\n {code`if (!isWindows || argv.length === 0) {\n return null;\n}\nconst base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\nconst cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\nif (!cliName) {\n return null;\n}\nconst nodeDir = dirname(process.execPath);\nconst cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\nif (!existsSync(cliPath)) {\n const command = argv[0] ?? \"\";\n const ext = extname(command).toLowerCase();\n const shimmedCommand = ext ? command : \\`\\${command}.cmd\\`;\n\n return [shimmedCommand, ...argv.slice(1)];\n}\nreturn [process.execPath, cliPath, ...argv.slice(1)];`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommand\"\n doc=\"Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).\"\n parameters={[{ name: \"command\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (!isWindows) {\n return command;\n}\nconst base = basename(command).toLowerCase();\nif (extname(base)) {\n return command;\n}\nif ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n}\nreturn command;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommandStdio\"\n parameters={[\n {\n name: \"params\",\n type: \"{ hasInput: boolean; preferInherit: boolean; }\"\n }\n ]}\n returnType='[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]'>\n {code`const stdin = params.hasInput\n ? \"pipe\"\n : params.preferInherit\n ? \"inherit\"\n : \"pipe\";\n\nreturn [stdin, \"pipe\", \"pipe\"];`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveChildProcessInvocation\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; windowsVerbatimArguments?: boolean; }\"\n }\n ]}\n returnType=\"{ args: string[]; command: string; usesWindowsExitCodeShim: boolean; windowsHide: true; windowsVerbatimArguments?: boolean; }\">\n {code`const finalArgv =\n isWindows\n ? (resolveNpmArgvForWindows(params.argv) ?? params.argv)\n : params.argv;\nconst resolvedCommand =\n finalArgv !== params.argv\n ? (finalArgv[0] ?? \"\")\n : resolveCommand(params.argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nreturn {\n command: useCmdWrapper\n ? (process.env.ComSpec ?? \"cmd.exe\")\n : resolvedCommand,\n args: useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, finalArgv.slice(1))\n ]\n : finalArgv.slice(1),\n usesWindowsExitCodeShim:\n isWindows &&\n (useCmdWrapper || finalArgv !== params.argv),\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : params.windowsVerbatimArguments\n};`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveProcessExitCode\"\n parameters={[\n {\n name: \"params\",\n type: \"{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }\"\n }\n ]}\n returnType=\"number | null\">\n {code`return (\n params.explicitCode ??\n params.childExitCode ??\n (params.usesWindowsExitCodeShim &&\n params.resolvedSignal == null &&\n !params.timedOut &&\n !params.noOutputTimedOut &&\n !params.killIssuedByTimeout\n ? 0\n : null)\n);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"shouldSpawnWithShell\"\n parameters={[\n {\n name: \"params\",\n type: \"{ resolvedCommand: string; platform: NodeJS.Platform; }\"\n }\n ]}\n returnType=\"boolean\">\n {code`// SECURITY: never enable \\`shell\\` for argv-based execution.\n// \\`shell\\` routes through cmd.exe on Windows, which turns untrusted argv values\n// (like chat prompts passed as CLI args) into command-injection primitives.\n// If you need a shell, use an explicit shell-wrapper argv (e.g. \\`cmd.exe /c ...\\`)\n// and validate/escape at the call site.\nvoid params;\nreturn false;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"The result of a spawn operation.\" />\n <InterfaceDeclaration export name=\"SpawnResult\">\n <TSDoc heading=\"The PID of the spawned child process, if available.\" />\n <InterfaceMember name=\"pid\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The standard output produced by the child process.\" />\n <InterfaceMember name=\"stdout\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The standard error produced by the child process.\" />\n <InterfaceMember name=\"stderr\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The exit code of the child process, if available.\" />\n <InterfaceMember name=\"code\" type=\"number | null\" />\n <Spacing />\n <TSDoc heading=\"The signal that caused the child process to terminate, if it was killed by a signal.\" />\n <InterfaceMember name=\"signal\" type=\"NodeJS.Signals | null\" />\n <Spacing />\n <TSDoc heading=\"Whether the child process was killed.\" />\n <InterfaceMember name=\"killed\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"The reason for the child process termination.\" />\n <InterfaceMember\n name=\"termination\"\n type={code`\"exit\" | \"timeout\" | \"no-output-timeout\" | \"signal\"`}\n />\n <Spacing />\n <TSDoc heading=\"Whether the child process timed out due to no output.\" />\n <InterfaceMember name=\"noOutputTimedOut\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Options for spawning a child process.\" />\n <InterfaceDeclaration export name=\"SpawnOptions\">\n <TSDoc heading=\"The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.\">\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue=\"300000\"\n />\n </TSDoc>\n <InterfaceMember name=\"timeoutMs\" type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The current working directory of the child process.\" />\n <InterfaceMember name=\"cwd\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The input to be passed to the child process.\" />\n <InterfaceMember name=\"input\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The environment variables for the child process.\" />\n <InterfaceMember name=\"env\" optional type=\"NodeJS.ProcessEnv\" />\n <Spacing />\n <TSDoc heading=\"Whether to pass arguments to the child process verbatim on Windows.\" />\n <InterfaceMember\n name=\"windowsVerbatimArguments\"\n optional\n type=\"boolean\"\n />\n <Spacing />\n <TSDoc heading=\"The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.\" />\n <InterfaceMember name=\"noOutputTimeoutMs\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS\"\n initializer={code`250`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_POLL_MS\"\n initializer={code`10`}\n />\n <Spacing />\n <TSDoc heading=\"Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.\">\n <TSDocParam name=\"argv\">\n {\"The command and its arguments to spawn.\"}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<SpawnResult>\">\n {code`const options: SpawnOptions =\n typeof optionsOrTimeoutMs === \"number\"\n ? { timeoutMs: optionsOrTimeoutMs }\n : optionsOrTimeoutMs;\nconst { timeoutMs, cwd, input, env, noOutputTimeoutMs } = options;\nconst hasInput = input !== undefined;\nconst resolvedEnv = resolveCommandEnv({ argv, env });\nconst stdio = resolveCommandStdio({ hasInput, preferInherit: true });\nconst invocation = resolveChildProcessInvocation({\n argv,\n windowsVerbatimArguments: options.windowsVerbatimArguments\n});\n\nconst child = _spawn(invocation.command, invocation.args, {\n stdio,\n cwd,\n env: resolvedEnv,\n windowsHide: invocation.windowsHide,\n windowsVerbatimArguments: invocation.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: invocation.command,\n platform: process.platform\n })\n ? { shell: true }\n : {})\n});\n\nreturn new Promise((resolve, reject) => {\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n let timedOut = false;\n let noOutputTimedOut = false;\n let killIssuedByTimeout = false;\n let childExitState: {\n code: number | null;\n signal: NodeJS.Signals | null;\n } | null = null;\n let closeFallbackTimer: NodeJS.Timeout | null = null;\n let noOutputTimer: NodeJS.Timeout | null = null;\n const shouldTrackOutputTimeout =\n typeof noOutputTimeoutMs === \"number\" &&\n Number.isFinite(noOutputTimeoutMs) &&\n noOutputTimeoutMs > 0;\n\n const clearNoOutputTimer = () => {\n if (!noOutputTimer) {\n return;\n }\n clearTimeout(noOutputTimer);\n noOutputTimer = null;\n };\n\n const clearCloseFallbackTimer = () => {\n if (!closeFallbackTimer) {\n return;\n }\n clearTimeout(closeFallbackTimer);\n closeFallbackTimer = null;\n };\n\n const killChild = () => {\n if (settled || typeof child?.kill !== \"function\") {\n return;\n }\n killIssuedByTimeout = true;\n child.kill(\"SIGKILL\");\n };\n\n const armNoOutputTimer = () => {\n if (!shouldTrackOutputTimeout || settled) {\n return;\n }\n clearNoOutputTimer();\n noOutputTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n noOutputTimedOut = true;\n killChild();\n }, Math.floor(noOutputTimeoutMs));\n };\n\n const timer = setTimeout(() => {\n timedOut = true;\n killChild();\n }, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);\n armNoOutputTimer();\n\n if (hasInput && child.stdin) {\n child.stdin.write(input ?? \"\");\n child.stdin.end();\n }\n\n child.stdout?.on(\"data\", (d: Stream) => {\n stdout += d.toString();\n armNoOutputTimer();\n });\n child.stderr?.on(\"data\", (d: Stream) => {\n stderr += d.toString();\n armNoOutputTimer();\n });\n child.on(\"error\", err => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n reject(err);\n });\n child.on(\"exit\", (code, signal) => {\n childExitState = { code, signal };\n if (settled || closeFallbackTimer) {\n return;\n }\n closeFallbackTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 250);\n });\n const resolveFromClose = (\n code: number | null,\n signal: NodeJS.Signals | null\n ) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n const resolvedSignal =\n childExitState?.signal ?? signal ?? child.signalCode ?? null;\n const resolvedCode = resolveProcessExitCode({\n explicitCode: childExitState?.code ?? code,\n childExitCode: child.exitCode,\n resolvedSignal,\n usesWindowsExitCodeShim: invocation.usesWindowsExitCodeShim,\n timedOut,\n noOutputTimedOut,\n killIssuedByTimeout\n });\n const termination = noOutputTimedOut\n ? \"no-output-timeout\"\n : timedOut\n ? \"timeout\"\n : resolvedSignal != null\n ? \"signal\"\n : \"exit\";\n const normalizedCode =\n termination === \"timeout\" || termination === \"no-output-timeout\"\n ? resolvedCode === 0\n ? 124\n : resolvedCode\n : resolvedCode;\n resolve({\n pid: child.pid ?? undefined,\n stdout,\n stderr,\n code: normalizedCode,\n signal: resolvedSignal,\n killed: child.killed,\n termination,\n noOutputTimedOut\n });\n };\n child.on(\"close\", (code, signal) => {\n if (\n !isWindows ||\n childExitState != null ||\n code != null ||\n signal != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n\n const startedAt = Date.now();\n const waitForExitState = () => {\n if (settled) {\n return;\n }\n if (\n childExitState != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n if (Date.now() - startedAt >= WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS) {\n resolveFromClose(code, signal);\n return;\n }\n setTimeout(waitForExitState, WINDOWS_CLOSE_STATE_POLL_MS);\n };\n waitForExitState();\n });\n});`}\n </FunctionDeclaration>\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAE,aAAiB,OAAA;CACjB,MAAA,CAAA,EACA,YACA,QAAO,WAAW,OAAO,CAAK,WAAW,CAAC;AAC5C,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